parameters: (user, book_title, status=None, book_url=None)
return_statement: return book
docstring: Creates book.
  
      @type user: C{django.contrib.auth.models.User}
      @param user: Booktype user who will be book owner
      @type book_title: C{string}
      @param book_title: Title for the book. If book_url is omitted it will slugify title for the url version
      @type status: C{string}
      @param status: String name for the status (optional)
      @type book_url: C{string}
      @param book_url: URL title for the book (optional)
  
      @rtype: C{booki.editor.models.Book}
      @return: Returns book object
docstring_summary: Creates book.
docstring_tokens: Creates book .
function: def create_book(user, book_title, status=None, book_url=None):
      """
      Creates book.
  
      @type user: C{django.contrib.auth.models.User}
      @param user: Booktype user who will be book owner
      @type book_title: C{string}
      @param book_title: Title for the book. If book_url is omitted it will slugify title for the url version
      @type status: C{string}
      @param status: String name for the status (optional)
      @type book_url: C{string}
      @param book_url: URL title for the book (optional)
  
      @rtype: C{booki.editor.models.Book}
      @return: Returns book object
      """
  
      if book_url:
          url_title = book_url[:100]
      else:
          url_title = booktype_slugify(book_title[:100])
  
      book = models.Book(
          url_title=url_title,
          title=book_title,
          owner=user,
          created=datetime.datetime.now(),
          published=datetime.datetime.now(),
          hidden=False,
          description='',
          cover=None
      )
      book.save()
  
      status_list = config.get_configuration('CHAPTER_STATUS_LIST')
      n = len(status_list)
  
      default_status = status if status else get_default_book_status()
  
      for status_elem in status_list:
          status = models.BookStatus(
              book=book, name=status_elem['name'],
              weight=n, color=status_elem['color']
          )
          status.save()
          n -= 1
  
      # not use "not published" but first in the list maybe, or just status
      book.status = models.BookStatus.objects.get(book=book, name=default_status)
      book.save()
  
      track_changes = config.get_configuration('BOOK_TRACK_CHANGES', False)
      version = models.BookVersion(
          book=book,
          major=1,
          minor=0,
          name='initial',
          description='',
          created=datetime.datetime.now(),
          track_changes=track_changes
      )
      version.save()
  
      book.version = version
      book.save()
  
      logBookHistory(
          book=book,
          version=version,
          user=user,
          kind='book_create'
      )
      booki.editor.signals.book_created.send(sender=user, book=book)
      return book
function_tokens: def create_book ( user , book_title , status = None , book_url = None ) : if book_url : url_title = book_url [ : 100 ] else : url_title = booktype_slugify ( book_title [ : 100 ] ) book = models . Book ( url_title = url_title , title = book_title , owner = user , created = datetime . datetime . now ( ) , published = datetime . datetime . now ( ) , hidden = False , description = '' , cover = None ) book . save ( ) status_list = config . get_configuration ( 'CHAPTER_STATUS_LIST' ) n = len ( status_list ) default_status = status if status else get_default_book_status ( ) for status_elem in status_list : status = models . BookStatus ( book = book , name = status_elem [ 'name' ] , weight = n , color = status_elem [ 'color' ] ) status . save ( ) n -= 1 # not use "not published" but first in the list maybe, or just status book . status = models . BookStatus . objects . get ( book = book , name = default_status ) book . save ( ) track_changes = config . get_configuration ( 'BOOK_TRACK_CHANGES' , False ) version = models . BookVersion ( book = book , major = 1 , minor = 0 , name = 'initial' , description = '' , created = datetime . datetime . now ( ) , track_changes = track_changes ) version . save ( ) book . version = version book . save ( ) logBookHistory ( book = book , version = version , user = user , kind = 'book_create' ) booki . editor . signals . book_created . send ( sender = user , book = book ) return book