diff --git a/controller/Notebooks.py b/controller/Notebooks.py index 86f81b3..cf5f74a 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -1263,8 +1263,8 @@ class Notebooks( object ): user = self.__database.load( User, note.user_id ) writer.writerow( ( - note.contents.encode( "utf8" ), - note.title.encode( "utf8" ), + note.contents and note.contents.encode( "utf8" ) or None, + 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"", diff --git a/controller/test/Test_controller.py b/controller/test/Test_controller.py index 8b5554a..2373fad 100644 --- a/controller/test/Test_controller.py +++ b/controller/test/Test_controller.py @@ -120,14 +120,6 @@ class Test_controller( object ): u"stream_response": True, u"encoding_filter.on": False, }, - u"/files/thumbnail": { - u"stream_response": True, - u"encoding_filter.on": False, - }, - u"/files/image": { - u"stream_response": True, - u"encoding_filter.on": False, - }, u"/notebooks/export_csv": { u"stream_response": True, u"encoding_filter.on": False, diff --git a/controller/test/Test_notebooks.py b/controller/test/Test_notebooks.py index 23faeab..bbdfb9d 100644 --- a/controller/test/Test_notebooks.py +++ b/controller/test/Test_notebooks.py @@ -3542,13 +3542,13 @@ class Test_notebooks( Test_controller ): assert result.get( "error" ) - def test_export_csv( self, note_text = None ): + def test_export_csv( self, note_contents = None ): self.login() - if not note_text: - note_text = u"foo" + if not note_contents: + note_contents = u"

blah

foo" - note3 = Note.create( "55", u"

blah

%s" % note_text, notebook_id = self.notebook.object_id ) + note3 = Note.create( "55", note_contents, notebook_id = self.notebook.object_id ) self.database.save( note3 ) result = self.http_get( @@ -3604,7 +3604,12 @@ class Test_notebooks( Test_controller ): db_note = self.database.load( Note, note_id ) assert db_note assert contents.decode( "utf8" ) == db_note.contents - assert title.decode( "utf8" ) == db_note.title + + if db_note.title: + assert title.decode( "utf8" ) == db_note.title + else: + assert not title + assert note_id.decode( "utf8" ) == db_note.object_id assert startup.decode( "utf8" ) == db_note.startup and u"1" or "0" assert username.decode( "utf8" ) == ( db_note.user_id and self.user.username or u"" ) @@ -3613,8 +3618,11 @@ class Test_notebooks( Test_controller ): assert note_count == expected_note_count def test_export_csv_with_unicode( self ): - self.test_export_csv( note_text = u"ümlaut.png" ) - + self.test_export_csv( note_contents = u"

blah

ümlaut.png" ) + + def test_export_csv_without_note_title( self ): + self.test_export_csv( note_contents = u"there's no title" ) + def test_export_csv_without_login( self ): note3 = Note.create( "55", u"

blah

foo", notebook_id = self.notebook.object_id ) self.database.save( note3 )