Make privacy policy accessible from sane URL.
This commit is contained in:
parent
cef3e0c679
commit
ebd427d667
|
@ -166,6 +166,26 @@ class Root( object ):
|
||||||
|
|
||||||
return result
|
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
|
# TODO: move this method to controller.Notebooks, and maybe give it a more sensible name
|
||||||
@expose( view = Json )
|
@expose( view = Json )
|
||||||
def next_id( self ):
|
def next_id( self ):
|
||||||
|
|
|
@ -37,6 +37,14 @@ class Test_root( Test_controller ):
|
||||||
)
|
)
|
||||||
self.database.save( self.guide_note )
|
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.username = u"mulder"
|
||||||
self.password = u"trustno1"
|
self.password = u"trustno1"
|
||||||
self.email_address = u"outthere@example.com"
|
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.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.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.guide_notebook.object_id ) )
|
||||||
|
self.database.execute( self.anonymous.sql_save_notebook( self.privacy_notebook.object_id ) )
|
||||||
|
|
||||||
def test_index( self ):
|
def test_index( self ):
|
||||||
result = self.http_get( "/" )
|
result = self.http_get( "/" )
|
||||||
|
@ -150,6 +159,14 @@ class Test_root( Test_controller ):
|
||||||
assert result
|
assert result
|
||||||
assert u"error" not in 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 ):
|
def test_next_id( self ):
|
||||||
result = self.http_get( "/next_id" )
|
result = self.http_get( "/next_id" )
|
||||||
|
|
||||||
|
|
Reference in New Issue