witten
/
luminotes
Archived
1
0
Fork 0

Make privacy policy accessible from sane URL.

This commit is contained in:
Dan Helfman 2007-11-13 00:59:19 +00:00
parent cef3e0c679
commit ebd427d667
2 changed files with 37 additions and 0 deletions

View File

@ -166,6 +166,26 @@ class Root( object ):
return result
@expose( view = Main_page )
@grab_user_id
@validate(
user_id = Valid_id( none_okay = True ),
)
def privacy( self, user_id = None ):
"""
Provide the information necessary to display the Luminotes privacy policy.
@rtype: unicode
@return: rendered HTML page
@raise Validation_error: one of the arguments is invalid
"""
result = self.__users.current( user_id )
privacy_notebooks = [ nb for nb in result[ "notebooks" ] if nb.name == u"Luminotes privacy policy" ]
result.update( self.__notebooks.contents( privacy_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 )
def next_id( self ):

View File

@ -37,6 +37,14 @@ class Test_root( Test_controller ):
)
self.database.save( self.guide_note )
self.privacy_notebook = Notebook.create( self.database.next_id( Notebook ), u"Luminotes privacy policy" )
self.database.save( self.privacy_notebook )
self.privacy_note = Note.create(
self.database.next_id( Note ), u"<h3>yay privacy</h3>",
notebook_id = self.privacy_notebook.object_id,
)
self.database.save( self.privacy_note )
self.username = u"mulder"
self.password = u"trustno1"
self.email_address = u"outthere@example.com"
@ -52,6 +60,7 @@ class Test_root( Test_controller ):
self.database.execute( self.anonymous.sql_save_notebook( self.anon_notebook.object_id ) )
self.database.execute( self.anonymous.sql_save_notebook( self.blog_notebook.object_id ) )
self.database.execute( self.anonymous.sql_save_notebook( self.guide_notebook.object_id ) )
self.database.execute( self.anonymous.sql_save_notebook( self.privacy_notebook.object_id ) )
def test_index( self ):
result = self.http_get( "/" )
@ -150,6 +159,14 @@ class Test_root( Test_controller ):
assert result
assert u"error" not in result
def test_privacy( self ):
result = self.http_get(
"/privacy",
)
assert result
assert u"error" not in result
def test_next_id( self ):
result = self.http_get( "/next_id" )