witten
/
luminotes
Archived
1
0
Fork 0

Attempting to access the RSS feed for a non-existent notebook now

displays a somewhat informative message in the feed instead of just
silently raising an error.
This commit is contained in:
Dan Helfman 2008-05-26 23:00:31 -07:00
parent 4083f7b52b
commit e971959755
4 changed files with 24 additions and 4 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
1.3.38: May 26, 2008
* Attempting to access the RSS feed for a non-existent notebook now
displays a somewhat informative message in the feed instead of just
silently raising an error.
1.3.37: May 20, 2008
* Fixed a bug where image preloading loaded incorrect paths for
certain images.

View File

@ -248,7 +248,12 @@ class Notebooks( object ):
"""
notebook = self.__database.load( Notebook, notebook_id )
if not notebook:
raise Access_error()
return dict(
recent_notes = [],
notebook_id = notebook_id,
notebook_name = notebook_name,
https_url = self.__https_url,
)
recent_notes = self.__database.select_many( Note, notebook.sql_load_notes( start = 0, count = 10 ) )

View File

@ -904,7 +904,11 @@ class Test_notebooks( Test_controller ):
"/notebooks/updates/%s?rss&notebook_name=%s" % ( self.unknown_notebook_id, self.notebook.name ),
)
assert u"access" in result[ "body" ][ 0 ]
# should return no notes (and not raise an error)
assert len( result[ u"recent_notes" ] ) == 0
assert result[ u"notebook_id" ] == self.unknown_notebook_id
assert result[ u"notebook_name" ] == self.notebook.name
assert result[ u"https_url" ] == self.settings[ u"global" ][ u"luminotes.https_url" ]
def test_updates_with_incorrect_notebook_name( self ):
result = self.http_get(

View File

@ -28,13 +28,19 @@ class Updates_rss( Rss_channel ):
cgi.escape( notebook_name ),
notebook_path,
u"Luminotes notebook",
[ Rss_item(
recent_notes and [ Rss_item(
title = u"Note updated",
link = self.note_link( notebook_id, notebook_name, note_id, revision, https_url ),
description = cgi.escape( u'A note in <a href="%s">this notebook</a> has been updated. <a href="%s?note_id=%s">View the note.</a>' % ( notebook_path, notebook_path, note_id ) ),
date = revision.strftime( "%Y-%m-%dT%H:%M:%SZ" ),
guid = self.note_link( notebook_id, notebook_name, note_id, revision, https_url ),
) for ( note_id, revision ) in recent_notes ],
) for ( note_id, revision ) in recent_notes ] or [ Rss_item(
title = u"Unknown notebook",
link = None,
description = cgi.escape( u'Sorry, that notebook is unknown.' ),
date = None,
guid = None,
) ],
)
@staticmethod