witten
/
luminotes
Archived
1
0
Fork 0

Bug fix: Used to get access error when you loaded the children links for a note that was in the trash.

This commit is contained in:
Dan Helfman 2008-04-29 21:26:09 +00:00
parent 53bc23f374
commit 5f852a3d8e
2 changed files with 24 additions and 1 deletions

View File

@ -543,8 +543,12 @@ class Notebooks( object ):
if not self.__users.check_access( user_id, notebook_id ):
raise Access_error()
notebook = self.__database.load( Notebook, notebook_id )
if not notebook:
raise Access_error()
note = self.__database.load( Note, note_id )
if note is None or note.notebook_id != notebook_id:
if note is None or note.notebook_id not in ( notebook_id, notebook.trash_id ):
raise Access_error()
items = []

View File

@ -1183,6 +1183,25 @@ class Test_notebooks( Test_controller ):
assert link % u' class="note_tree_link"' in html
assert u"tree_expander_empty" in html
def test_load_note_links_of_note_in_trash( self ):
self.login()
link = u'<a href="/notebooks/nbid?note_id=' + self.note2.object_id + '"%s>link to note2</a>'
self.note.contents = u"<h3>blah</h3> this is a %s" % ( link % "" )
self.note.deleted_from_id = self.note.notebook_id
self.note.notebook_id = self.trash.object_id
self.database.save( self.note )
result = self.http_post( "/notebooks/load_note_links/", dict(
notebook_id = self.notebook.object_id,
note_id = self.note.object_id,
), session_id = self.session_id )
html = result.get( "tree_html" )
assert u"<table"
assert link % u' class="note_tree_link"' in html
assert u"tree_expander_empty" in html
def test_load_note_links_with_note_link_with_uppercase_tags( self ):
self.login()