Fixed bug in which attempting to export a notebook containing a note saved by a user without a username would raise an error.
This commit is contained in:
parent
61fb8cc079
commit
c04475fc7e
|
@ -1267,7 +1267,7 @@ class Notebooks( object ):
|
|||
note.title and note.title.encode( "utf8" ) or None,
|
||||
note.object_id,
|
||||
note.startup and 1 or 0,
|
||||
note.user_id and user and user.username.encode( "utf8" ) or u"",
|
||||
note.user_id and user and user.username and user.username.encode( "utf8" ) or u"",
|
||||
note.revision,
|
||||
) )
|
||||
|
||||
|
|
|
@ -3623,6 +3623,12 @@ class Test_notebooks( Test_controller ):
|
|||
def test_export_csv_without_note_title( self ):
|
||||
self.test_export_csv( note_contents = u"there's no title" )
|
||||
|
||||
def test_export_csv_with_blank_username( self ):
|
||||
self.user._User__username = None
|
||||
self.database.save( self.user )
|
||||
|
||||
self.test_export_csv( note_contents = u"<h3>blah</h3>foo" )
|
||||
|
||||
def test_export_csv_without_login( self ):
|
||||
note3 = Note.create( "55", u"<h3>blah</h3>foo", notebook_id = self.notebook.object_id )
|
||||
self.database.save( note3 )
|
||||
|
|
Reference in New Issue