witten
/
luminotes
Archived
1
0
Fork 0

controller.Root.guide() now accepts an optional note_id parameter.

This commit is contained in:
Dan Helfman 2008-07-03 16:29:42 -07:00
parent 3fd3f23fe0
commit bbb17e4046
3 changed files with 20 additions and 1 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
1.4.11: June 29, 2008:
* Fixed bug in which bolding of suggest-as-you-type search text was case
sensitive. Now it's case insensitive.
* controller.Root.guide() now accepts an optional note_id parameter.
1.4.10: June 29, 2008:
* New suggest-as-you-type feature for creating a new link, setting a link's

View File

@ -229,6 +229,8 @@ class Root( object ):
@param start: index of recent note to start with (defaults to 0, the most recent note)
@type count: int or NoneType
@param count: number of recent notes to display (defaults to 10 notes)
@type note_id: unicode or NoneType
@param note_id: id of single note to load (optional)
@rtype: unicode
@return: rendered HTML page
@raise Validation_error: one of the arguments is invalid
@ -250,12 +252,15 @@ class Root( object ):
@end_transaction
@grab_user_id
@validate(
note_id = Valid_id( none_okay = True ),
user_id = Valid_id( none_okay = True ),
)
def guide( self, user_id = None ):
def guide( self, note_id = None, user_id = None ):
"""
Provide the information necessary to display the Luminotes user guide.
@type note_id: unicode or NoneType
@param note_id: id of single note to load (optional)
@rtype: unicode
@return: rendered HTML page
@raise Validation_error: one of the arguments is invalid
@ -265,6 +270,10 @@ class Root( object ):
result.update( self.__notebooks.contents( guide_notebooks[ 0 ].object_id, user_id = user_id ) )
# if a single note was requested, just return that one note
if note_id:
result[ "startup_notes" ] = [ note for note in result[ "startup_notes" ] if note.object_id == note_id ]
return result
@expose( view = Main_page )

View File

@ -347,6 +347,15 @@ class Test_root( Test_controller ):
assert u"error" not in result
assert result[ u"notebook" ].object_id == self.guide_notebook.object_id
def test_guide_with_note_id( self ):
result = self.http_get(
"/guide?note_id=%s" % self.guide_note.object_id,
)
assert result
assert u"error" not in result
assert result[ u"notebook" ].object_id == self.guide_notebook.object_id
def test_privacy( self ):
result = self.http_get(
"/privacy",