Leading/trailing spaces and newlines in note titles and contents are now stripped out when exporting to CSV.
This commit is contained in:
parent
80a0250c95
commit
4d24914496
2
NEWS
2
NEWS
|
@ -2,6 +2,8 @@
|
||||||
* Leading/trailing spaces in note titles are now ignored when making links
|
* Leading/trailing spaces in note titles are now ignored when making links
|
||||||
to such notes. This means that creating a link titled "my note" to a note
|
to such notes. This means that creating a link titled "my note" to a note
|
||||||
called "my note " now works properly.
|
called "my note " now works properly.
|
||||||
|
* Leading/trailing spaces and newlines in note titles and contents are now
|
||||||
|
stripped out when exporting to CSV.
|
||||||
* Fixed a bug in which clicking the "export" link when the current note was
|
* Fixed a bug in which clicking the "export" link when the current note was
|
||||||
unsaved did not open the export pulldown.
|
unsaved did not open the export pulldown.
|
||||||
|
|
||||||
|
|
|
@ -1263,8 +1263,8 @@ class Notebooks( object ):
|
||||||
user = self.__database.load( User, note.user_id )
|
user = self.__database.load( User, note.user_id )
|
||||||
|
|
||||||
writer.writerow( (
|
writer.writerow( (
|
||||||
note.contents and note.contents.encode( "utf8" ) or None,
|
note.contents and note.contents.strip().encode( "utf8" ) or None,
|
||||||
note.title and note.title.encode( "utf8" ) or None,
|
note.title and note.title.strip().encode( "utf8" ) or None,
|
||||||
note.object_id,
|
note.object_id,
|
||||||
note.startup and 1 or 0,
|
note.startup and 1 or 0,
|
||||||
note.user_id and user and user.username and user.username.encode( "utf8" ) or u"",
|
note.user_id and user and user.username and user.username.encode( "utf8" ) or u"",
|
||||||
|
|
|
@ -3619,10 +3619,10 @@ class Test_notebooks( Test_controller ):
|
||||||
|
|
||||||
db_note = self.database.load( Note, note_id )
|
db_note = self.database.load( Note, note_id )
|
||||||
assert db_note
|
assert db_note
|
||||||
assert contents.decode( "utf8" ) == db_note.contents
|
assert contents.decode( "utf8" ) == db_note.contents.strip()
|
||||||
|
|
||||||
if db_note.title:
|
if db_note.title:
|
||||||
assert title.decode( "utf8" ) == db_note.title
|
assert title.decode( "utf8" ) == db_note.title.strip()
|
||||||
else:
|
else:
|
||||||
assert not title
|
assert not title
|
||||||
|
|
||||||
|
@ -3639,6 +3639,12 @@ class Test_notebooks( Test_controller ):
|
||||||
def test_export_csv_without_note_title( self ):
|
def test_export_csv_without_note_title( self ):
|
||||||
self.test_export_csv( note_contents = u"there's no title" )
|
self.test_export_csv( note_contents = u"there's no title" )
|
||||||
|
|
||||||
|
def test_export_csv_with_trailing_newline_in_title( self ):
|
||||||
|
self.test_export_csv( note_contents = u"<h3>blah\n</h3>foo" )
|
||||||
|
|
||||||
|
def test_export_csv_with_trailing_newline_in_contents( self ):
|
||||||
|
self.test_export_csv( note_contents = u"<h3>blah</h3>foo\n" )
|
||||||
|
|
||||||
def test_export_csv_with_blank_username( self ):
|
def test_export_csv_with_blank_username( self ):
|
||||||
self.user._User__username = None
|
self.user._User__username = None
|
||||||
self.database.save( self.user )
|
self.database.save( self.user )
|
||||||
|
|
Reference in New Issue