diff --git a/controller/Root.py b/controller/Root.py index d4d7a3e..40b5e37 100644 --- a/controller/Root.py +++ b/controller/Root.py @@ -134,7 +134,29 @@ class Root( object ): result = self.__users.current( user_id = None ) blog_notebooks = [ nb for nb in result[ "notebooks" ] if nb.name == u"Luminotes blog" ] - return self.__notebooks.load_recent_notes( blog_notebooks[ 0 ].object_id, start, count, user_id ) + result.update( self.__notebooks.load_recent_notes( blog_notebooks[ 0 ].object_id, start, count, user_id ) ) + + return result + + @expose( view = Main_page ) + @grab_user_id + @validate( + user_id = Valid_id( none_okay = True ), + ) + def guide( self, user_id = None ): + """ + Provide the information necessary to display the Luminotes user guide. + + @rtype: unicode + @return: rendered HTML page + @raise Validation_error: one of the arguments is invalid + """ + result = self.__users.current( user_id = None ) + guide_notebooks = [ nb for nb in result[ "notebooks" ] if nb.name == u"Luminotes user guide" ] + + result.update( self.__notebooks.contents( guide_notebooks[ 0 ].object_id, user_id = user_id ) ) + + return result # TODO: move this method to controller.Notebooks, and maybe give it a more sensible name @expose( view = Json ) diff --git a/controller/test/Test_root.py b/controller/test/Test_root.py index be1df63..57f1e77 100644 --- a/controller/test/Test_root.py +++ b/controller/test/Test_root.py @@ -29,6 +29,14 @@ class Test_root( Test_controller ): ) self.database.save( self.blog_note ) + self.guide_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes user guide" ) + self.database.save( self.guide_notebook ) + self.guide_note = Note.create( + self.database.next_id( Note ), u"