witten
/
luminotes
Archived
1
0
Fork 0

Leading/trailing spaces and newlines in note titles and contents are now stripped out when exporting to CSV.

This commit is contained in:
Dan Helfman 2008-09-29 23:35:45 -07:00
parent 80a0250c95
commit 4d24914496
3 changed files with 12 additions and 4 deletions

2
NEWS
View File

@ -2,6 +2,8 @@
* 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
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
unsaved did not open the export pulldown.

View File

@ -1263,8 +1263,8 @@ class Notebooks( object ):
user = self.__database.load( User, note.user_id )
writer.writerow( (
note.contents and note.contents.encode( "utf8" ) or None,
note.title and note.title.encode( "utf8" ) or None,
note.contents and note.contents.strip().encode( "utf8" ) or None,
note.title and note.title.strip().encode( "utf8" ) or None,
note.object_id,
note.startup and 1 or 0,
note.user_id and user and user.username and user.username.encode( "utf8" ) or u"",

View File

@ -3619,10 +3619,10 @@ class Test_notebooks( Test_controller ):
db_note = self.database.load( Note, note_id )
assert db_note
assert contents.decode( "utf8" ) == db_note.contents
assert contents.decode( "utf8" ) == db_note.contents.strip()
if db_note.title:
assert title.decode( "utf8" ) == db_note.title
assert title.decode( "utf8" ) == db_note.title.strip()
else:
assert not title
@ -3639,6 +3639,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_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 ):
self.user._User__username = None
self.database.save( self.user )