From 0976fdf8c66a00a83b894c658b180f93fb9ce88a Mon Sep 17 00:00:00 2001
From: Dan Helfman blah blah
-Sound interesting? Then take a tour or try it out for yourself!
+Sound interesting? Then take a tour or try it out for yourself!
-Luminotes makes use of some advanced browser features,
+Luminotes makes use of some advanced browser features,
so not all browsers will work for editing your wiki. Supported browsers include:
my title
blah" )
- self.notebook.add_entry( self.entry )
- self.notebook.add_startup_entry( self.entry )
+ self.note = Note( ( yield Scheduler.SLEEP ), u"my title
blah" )
+ self.notebook.add_note( self.note )
+ self.notebook.add_startup_note( self.note )
self.database.next_id( self.scheduler.thread )
- self.entry2 = Entry( ( yield Scheduler.SLEEP ), u"other title
whee" )
- self.notebook.add_entry( self.entry2 )
+ self.note2 = Note( ( yield Scheduler.SLEEP ), u"other title
whee" )
+ self.notebook.add_note( self.note2 )
self.database.save( self.notebook )
self.database.next_id( self.scheduler.thread )
@@ -73,8 +73,8 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
assert notebook.object_id == self.notebook.object_id
- assert len( notebook.startup_entries ) == 1
- assert notebook.startup_entries[ 0 ] == self.entry
+ assert len( notebook.startup_notes ) == 1
+ assert notebook.startup_notes[ 0 ] == self.note
def test_contents_without_login( self ):
result = self.http_get(
@@ -84,269 +84,269 @@ class Test_notebooks( Test_controller ):
assert result.get( "error" )
- def test_load_entry( self ):
+ def test_load_note( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry/", dict(
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == self.entry.object_id
- assert entry.title == self.entry.title
- assert entry.contents == self.entry.contents
+ assert note.object_id == self.note.object_id
+ assert note.title == self.note.title
+ assert note.contents == self.note.contents
- def test_load_entry_without_login( self ):
- result = self.http_post( "/notebooks/load_entry/", dict(
+ def test_load_note_without_login( self ):
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
assert result.get( "error" )
- def test_load_entry_with_unknown_notebook( self ):
+ def test_load_note_with_unknown_notebook( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry/", dict(
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.unknown_notebook_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
assert result.get( "error" )
- def test_load_unknown_entry( self ):
+ def test_load_unknown_note( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry/", dict(
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.unknown_entry_id,
+ note_id = self.unknown_note_id,
), session_id = self.session_id )
- entry = result[ "entry" ]
- assert entry == None
+ note = result[ "note" ]
+ assert note == None
- def test_load_entry_by_title( self ):
+ def test_load_note_by_title( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = self.entry.title,
+ note_title = self.note.title,
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == self.entry.object_id
- assert entry.title == self.entry.title
- assert entry.contents == self.entry.contents
+ assert note.object_id == self.note.object_id
+ assert note.title == self.note.title
+ assert note.contents == self.note.contents
- def test_load_entry_by_title_without_login( self ):
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ def test_load_note_by_title_without_login( self ):
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = self.entry.title,
+ note_title = self.note.title,
), session_id = self.session_id )
assert result.get( "error" )
- def test_load_entry_by_title_with_unknown_notebook( self ):
+ def test_load_note_by_title_with_unknown_notebook( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.unknown_notebook_id,
- entry_title = self.entry.title,
+ note_title = self.note.title,
), session_id = self.session_id )
assert result.get( "error" )
- def test_load_unknown_entry_by_title( self ):
+ def test_load_unknown_note_by_title( self ):
self.login()
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = "unknown title",
+ note_title = "unknown title",
), session_id = self.session_id )
- entry = result[ "entry" ]
- assert entry == None
+ note = result[ "note" ]
+ assert note == None
- def test_save_entry( self, startup = False ):
+ def test_save_note( self, startup = False ):
self.login()
- # save over an existing entry supplying new contents and a new title
- new_entry_contents = u"new title
new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"new title
new blah"
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
- contents = new_entry_contents,
+ note_id = self.note.object_id,
+ contents = new_note_contents,
startup = startup,
), session_id = self.session_id )
assert result[ "saved" ] == True
# make sure the old title can no longer be loaded
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = "my title",
+ note_title = "my title",
), session_id = self.session_id )
- entry = result[ "entry" ]
- assert entry == None
+ note = result[ "note" ]
+ assert note == None
# make sure the new title is now loadable
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = "new title",
+ note_title = "new title",
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == self.entry.object_id
- assert entry.title == self.entry.title
- assert entry.contents == self.entry.contents
+ assert note.object_id == self.note.object_id
+ assert note.title == self.note.title
+ assert note.contents == self.note.contents
- # check that the entry is / is not a startup entry
+ # check that the note is / is not a startup note
if startup:
- assert entry in self.notebook.startup_entries
+ assert note in self.notebook.startup_notes
else:
- assert not entry in self.notebook.startup_entries
+ assert not note in self.notebook.startup_notes
- def test_save_startup_entry( self ):
- self.test_save_entry( startup = True )
+ def test_save_startup_note( self ):
+ self.test_save_note( startup = True )
- def test_save_entry_without_login( self, startup = False ):
- # save over an existing entry supplying new contents and a new title
- new_entry_contents = u"new title
new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ def test_save_note_without_login( self, startup = False ):
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"new title
new blah"
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
- contents = new_entry_contents,
+ note_id = self.note.object_id,
+ contents = new_note_contents,
startup = startup,
), session_id = self.session_id )
assert result.get( "error" )
- def test_save_startup_entry_without_login( self ):
- self.test_save_entry_without_login( startup = True )
+ def test_save_startup_note_without_login( self ):
+ self.test_save_note_without_login( startup = True )
- def test_save_entry_with_unknown_notebook( self ):
+ def test_save_note_with_unknown_notebook( self ):
self.login()
- # save over an existing entry supplying new contents and a new title
- new_entry_contents = u"new title
new blah"
- result = self.http_post( "/notebooks/save_entry/", dict(
+ # save over an existing note supplying new contents and a new title
+ new_note_contents = u"new title
new blah"
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.unknown_notebook_id,
- entry_id = self.entry.object_id,
- contents = new_entry_contents,
+ note_id = self.note.object_id,
+ contents = new_note_contents,
startup = False,
), session_id = self.session_id )
assert result.get( "error" )
- def test_save_new_entry( self, startup = False ):
+ def test_save_new_note( self, startup = False ):
self.login()
- # save a completely new entry
- new_entry = Entry( "55", u"newest title
foo" )
- result = self.http_post( "/notebooks/save_entry/", dict(
+ # save a completely new note
+ new_note = Note( "55", u"newest title
foo" )
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = new_entry.object_id,
- contents = new_entry.contents,
+ note_id = new_note.object_id,
+ contents = new_note.contents,
startup = startup,
), session_id = self.session_id )
assert result[ "saved" ] == True
# make sure the new title is now loadable
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = new_entry.title,
+ note_title = new_note.title,
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == new_entry.object_id
- assert entry.title == new_entry.title
- assert entry.contents == new_entry.contents
+ assert note.object_id == new_note.object_id
+ assert note.title == new_note.title
+ assert note.contents == new_note.contents
- # check that the entry is / is not a startup entry
+ # check that the note is / is not a startup note
if startup:
- assert entry in self.notebook.startup_entries
+ assert note in self.notebook.startup_notes
else:
- assert not entry in self.notebook.startup_entries
+ assert not note in self.notebook.startup_notes
- def test_save_new_startup_entry( self ):
- self.test_save_new_entry( startup = True )
+ def test_save_new_startup_note( self ):
+ self.test_save_new_note( startup = True )
- def test_save_new_entry_with_disallowed_tags( self ):
+ def test_save_new_note_with_disallowed_tags( self ):
self.login()
- # save a completely new entry
+ # save a completely new note
title_with_tags = u"my title
"
junk = u"foo"
more_junk = u"newest title
foo"
junk = "\xa0bar"
- new_entry = Entry( "55", contents + junk )
- result = self.http_post( "/notebooks/save_entry/", dict(
+ new_note = Note( "55", contents + junk )
+ result = self.http_post( "/notebooks/save_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = new_entry.object_id,
- contents = new_entry.contents,
+ note_id = new_note.object_id,
+ contents = new_note.contents,
startup = False,
), session_id = self.session_id )
assert result[ "saved" ] == True
# make sure the new title is now loadable
- result = self.http_post( "/notebooks/load_entry_by_title/", dict(
+ result = self.http_post( "/notebooks/load_note_by_title/", dict(
notebook_id = self.notebook.object_id,
- entry_title = new_entry.title,
+ note_title = new_note.title,
), session_id = self.session_id )
- entry = result[ "entry" ]
+ note = result[ "note" ]
- assert entry.object_id == new_entry.object_id
- assert entry.title == new_entry.title
- assert entry.contents == contents + " bar"
+ assert note.object_id == new_note.object_id
+ assert note.title == new_note.title
+ assert note.contents == contents + " bar"
- def test_add_startup_entry( self ):
+ def test_add_startup_note( self ):
self.login()
- result = self.http_post( "/notebooks/add_startup_entry/", dict(
+ result = self.http_post( "/notebooks/add_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry2.object_id,
+ note_id = self.note2.object_id,
), session_id = self.session_id )
- # test that the added entry shows up in notebook.startup_entries
+ # test that the added note shows up in notebook.startup_notes
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -354,27 +354,27 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 2
- assert notebook.startup_entries[ 0 ] == self.entry
- assert notebook.startup_entries[ 1 ] == self.entry2
+ assert len( notebook.startup_notes ) == 2
+ assert notebook.startup_notes[ 0 ] == self.note
+ assert notebook.startup_notes[ 1 ] == self.note2
- def test_add_startup_entry_without_login( self ):
- result = self.http_post( "/notebooks/add_startup_entry/", dict(
+ def test_add_startup_note_without_login( self ):
+ result = self.http_post( "/notebooks/add_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry2.object_id,
+ note_id = self.note2.object_id,
), session_id = self.session_id )
assert result.get( "error" )
- def test_add_startup_entry_with_unknown_notebook( self ):
+ def test_add_startup_note_with_unknown_notebook( self ):
self.login()
- result = self.http_post( "/notebooks/add_startup_entry/", dict(
+ result = self.http_post( "/notebooks/add_startup_note/", dict(
notebook_id = self.unknown_notebook_id,
- entry_id = self.entry2.object_id,
+ note_id = self.note2.object_id,
), session_id = self.session_id )
- # test that notebook.startup_entries hasn't changed
+ # test that notebook.startup_notes hasn't changed
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -382,18 +382,18 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 1
- assert notebook.startup_entries[ 0 ] == self.entry
+ assert len( notebook.startup_notes ) == 1
+ assert notebook.startup_notes[ 0 ] == self.note
- def test_add_startup_unknown_entry( self ):
+ def test_add_startup_unknown_note( self ):
self.login()
- result = self.http_post( "/notebooks/add_startup_entry/", dict(
+ result = self.http_post( "/notebooks/add_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.unknown_entry_id,
+ note_id = self.unknown_note_id,
), session_id = self.session_id )
- # test that notebook.startup_entries hasn't changed
+ # test that notebook.startup_notes hasn't changed
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -401,18 +401,18 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 1
- assert notebook.startup_entries[ 0 ] == self.entry
+ assert len( notebook.startup_notes ) == 1
+ assert notebook.startup_notes[ 0 ] == self.note
- def test_remove_startup_entry( self ):
+ def test_remove_startup_note( self ):
self.login()
- result = self.http_post( "/notebooks/remove_startup_entry/", dict(
+ result = self.http_post( "/notebooks/remove_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- # test that the remove entry no longer shows up in notebook.startup_entries
+ # test that the remove note no longer shows up in notebook.startup_notes
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -420,25 +420,25 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 0
+ assert len( notebook.startup_notes ) == 0
- def test_remove_startup_entry_without_login( self ):
- result = self.http_post( "/notebooks/remove_startup_entry/", dict(
+ def test_remove_startup_note_without_login( self ):
+ result = self.http_post( "/notebooks/remove_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
assert result.get( "error" )
- def test_remove_startup_entry_with_unknown_notebook( self ):
+ def test_remove_startup_note_with_unknown_notebook( self ):
self.login()
- result = self.http_post( "/notebooks/remove_startup_entry/", dict(
+ result = self.http_post( "/notebooks/remove_startup_note/", dict(
notebook_id = self.unknown_notebook_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- # test that notebook.startup_entries hasn't changed
+ # test that notebook.startup_notes hasn't changed
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -446,18 +446,18 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 1
- assert notebook.startup_entries[ 0 ] == self.entry
+ assert len( notebook.startup_notes ) == 1
+ assert notebook.startup_notes[ 0 ] == self.note
- def test_remove_startup_unknown_entry( self ):
+ def test_remove_startup_unknown_note( self ):
self.login()
- result = self.http_post( "/notebooks/remove_startup_entry/", dict(
+ result = self.http_post( "/notebooks/remove_startup_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.unknown_entry_id,
+ note_id = self.unknown_note_id,
), session_id = self.session_id )
- # test that notebook.startup_entries hasn't changed
+ # test that notebook.startup_notes hasn't changed
result = self.http_get(
"/notebooks/contents?notebook_id=%s" % self.notebook.object_id,
session_id = self.session_id,
@@ -465,69 +465,69 @@ class Test_notebooks( Test_controller ):
notebook = result[ "notebook" ]
- assert len( notebook.startup_entries ) == 1
- assert notebook.startup_entries[ 0 ] == self.entry
+ assert len( notebook.startup_notes ) == 1
+ assert notebook.startup_notes[ 0 ] == self.note
- def test_delete_entry( self ):
+ def test_delete_note( self ):
self.login()
- result = self.http_post( "/notebooks/delete_entry/", dict(
+ result = self.http_post( "/notebooks/delete_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- # test that the delete entry is actually deleted
- result = self.http_post( "/notebooks/load_entry/", dict(
+ # test that the delete note is actually deleted
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- assert result.get( "entry" ) == None
+ assert result.get( "note" ) == None
- def test_delete_entry_without_login( self ):
- result = self.http_post( "/notebooks/delete_entry/", dict(
+ def test_delete_note_without_login( self ):
+ result = self.http_post( "/notebooks/delete_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
assert result.get( "error" )
- def test_delete_entry_with_unknown_notebook( self ):
+ def test_delete_note_with_unknown_notebook( self ):
self.login()
- result = self.http_post( "/notebooks/delete_entry/", dict(
+ result = self.http_post( "/notebooks/delete_note/", dict(
notebook_id = self.unknown_notebook_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- # test that the entry hasn't been deleted
- result = self.http_post( "/notebooks/load_entry/", dict(
+ # test that the note hasn't been deleted
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- entry = result.get( "entry" )
- assert entry.object_id == self.entry.object_id
+ note = result.get( "note" )
+ assert note.object_id == self.note.object_id
- def test_delete_unknown_entry( self ):
+ def test_delete_unknown_note( self ):
self.login()
- result = self.http_post( "/notebooks/delete_entry/", dict(
+ result = self.http_post( "/notebooks/delete_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.unknown_entry_id,
+ note_id = self.unknown_note_id,
), session_id = self.session_id )
- # test that the entry hasn't been deleted
- result = self.http_post( "/notebooks/load_entry/", dict(
+ # test that the note hasn't been deleted
+ result = self.http_post( "/notebooks/load_note/", dict(
notebook_id = self.notebook.object_id,
- entry_id = self.entry.object_id,
+ note_id = self.note.object_id,
), session_id = self.session_id )
- entry = result.get( "entry" )
- assert entry.object_id == self.entry.object_id
+ note = result.get( "note" )
+ assert note.object_id == self.note.object_id
- def test_blank_entry( self ):
- result = self.http_get( "/notebooks/blank_entry/5" )
+ def test_blank_note( self ):
+ result = self.http_get( "/notebooks/blank_note/5" )
assert result[ u"id" ] == u"5"
def test_search( self ):
@@ -540,10 +540,10 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 1
- assert entries[ 0 ].object_id == self.entry.object_id
+ assert len( notes ) == 1
+ assert notes[ 0 ].object_id == self.note.object_id
def test_search_without_login( self ):
search_text = u"bla"
@@ -565,10 +565,10 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 1
- assert entries[ 0 ].object_id == self.entry.object_id
+ assert len( notes ) == 1
+ assert notes[ 0 ].object_id == self.note.object_id
def test_empty_search( self ):
self.login()
@@ -580,9 +580,9 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 0
+ assert len( notes ) == 0
def test_search_with_no_results( self ):
self.login()
@@ -594,17 +594,17 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 0
+ assert len( notes ) == 0
def test_search_title_and_contents( self ):
self.login()
- # ensure that entries with titles matching the search text show up before entries with only
+ # ensure that notes with titles matching the search text show up before notes with only
# contents matching the search text
- entry3 = Entry( "55", u"blah
foo" )
- self.notebook.add_entry( entry3 )
+ note3 = Note( "55", u"blah
foo" )
+ self.notebook.add_note( note3 )
self.database.save( self.notebook )
@@ -615,11 +615,11 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 2
- assert entries[ 0 ].object_id == entry3.object_id
- assert entries[ 1 ].object_id == self.entry.object_id
+ assert len( notes ) == 2
+ assert notes[ 0 ].object_id == note3.object_id
+ assert notes[ 1 ].object_id == self.note.object_id
def test_search_html_tags( self ):
self.login()
@@ -631,25 +631,25 @@ class Test_notebooks( Test_controller ):
search_text = search_text,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 0
+ assert len( notes ) == 0
- def test_recent_entries( self ):
+ def test_recent_notes( self ):
self.login()
- result = self.http_post( "/notebooks/recent_entries/", dict(
+ result = self.http_post( "/notebooks/recent_notes/", dict(
notebook_id = self.notebook.object_id,
), session_id = self.session_id )
- entries = result.get( "entries" )
+ notes = result.get( "notes" )
- assert len( entries ) == 2
- assert entries[ 0 ].object_id == self.entry2.object_id
- assert entries[ 1 ].object_id == self.entry.object_id
+ assert len( notes ) == 2
+ assert notes[ 0 ].object_id == self.note2.object_id
+ assert notes[ 1 ].object_id == self.note.object_id
- def test_recent_entries_without_login( self ):
- result = self.http_post( "/notebooks/recent_entries/", dict(
+ def test_recent_notes_without_login( self ):
+ result = self.http_post( "/notebooks/recent_notes/", dict(
notebook_id = self.notebook.object_id,
), session_id = self.session_id )
@@ -658,8 +658,8 @@ class Test_notebooks( Test_controller ):
def test_download_html( self ):
self.login()
- entry3 = Entry( "55", u"blah
foo" )
- self.notebook.add_entry( entry3 )
+ note3 = Note( "55", u"blah
foo" )
+ self.notebook.add_note( note3 )
result = self.http_get(
"/notebooks/download_html/%s" % self.notebook.object_id,
@@ -667,26 +667,26 @@ class Test_notebooks( Test_controller ):
)
assert result.get( "notebook_name" ) == self.notebook.name
- entries = result.get( "entries" )
- assert len( entries ) == len( self.notebook.entries )
- startup_entry_allowed = True
+ notes = result.get( "notes" )
+ assert len( notes ) == len( self.notebook.notes )
+ startup_note_allowed = True
previous_revision = None
- # assert that startup entries come first, then normal entries in descending revision order
- for entry in entries:
- if entry in self.notebook.startup_entries:
- assert startup_entry_allowed
+ # assert that startup notes come first, then normal notes in descending revision order
+ for note in notes:
+ if note in self.notebook.startup_notes:
+ assert startup_note_allowed
else:
- startup_entry_allowed = False
- assert entry in self.notebook.entries
+ startup_note_allowed = False
+ assert note in self.notebook.notes
if previous_revision:
- assert entry.revision < previous_revision
+ assert note.revision < previous_revision
- previous_revision = entry.revision
+ previous_revision = note.revision
def test_download_html( self ):
- entry3 = Entry( "55", u"blah
foo" )
- self.notebook.add_entry( entry3 )
+ note3 = Note( "55", u"blah
foo" )
+ self.notebook.add_note( note3 )
result = self.http_get(
"/notebooks/download_html/%s" % self.notebook.object_id,
diff --git a/controller/test/Test_users.py b/controller/test/Test_users.py
index 9478d03..851ed92 100644
--- a/controller/test/Test_users.py
+++ b/controller/test/Test_users.py
@@ -77,8 +77,8 @@ class Test_users( Test_controller ):
assert notebooks[ 0 ] == self.anon_notebook
notebook = notebooks[ 1 ]
assert notebook.object_id == new_notebook_id
- assert len( notebook.entries ) == 1
- assert len( notebook.startup_entries ) == 1
+ assert len( notebook.notes ) == 1
+ assert len( notebook.startup_notes ) == 1
def test_signup_with_different_passwords( self ):
result = self.http_post( "/users/signup", dict(
diff --git a/model/Entry.py b/model/Note.py
similarity index 62%
rename from model/Entry.py
rename to model/Note.py
index 894cec2..d447836 100644
--- a/model/Entry.py
+++ b/model/Note.py
@@ -3,22 +3,31 @@ from Persistent import Persistent
from controller.Html_nuker import Html_nuker
-class Entry( Persistent ):
+class Note( Persistent ):
+ def __setstate__(self, state):
+ if "_Entry__title" in state:
+ state[ "_Note__title" ] = state[ "_Entry__title" ]
+ del( state[ "_Entry__title" ] )
+ if "_Entry__contents" in state:
+ state[ "_Note__contents" ] = state[ "_Entry__contents" ]
+ del( state[ "_Entry__contents" ] )
+ self.__dict__ = state
+
"""
- An single textual wiki entry.
+ An single textual wiki note.
"""
TITLE_PATTERN = re.compile( u"(.*)
", flags = re.IGNORECASE )
def __init__( self, id, contents = None ):
"""
- Create a new entry with the given id and contents.
+ Create a new note with the given id and contents.
@type id: unicode
- @param id: id of the entry
+ @param id: id of the note
@type contents: unicode or NoneType
- @param contents: initial contents of the entry (optional)
- @rtype: Entry
- @return: newly constructed entry
+ @param contents: initial contents of the note (optional)
+ @rtype: Note
+ @return: newly constructed note
"""
Persistent.__init__( self, id )
self.__title = None
@@ -31,7 +40,7 @@ class Entry( Persistent ):
self.__contents = contents
# parse title out of the beginning of the contents
- result = Entry.TITLE_PATTERN.search( contents )
+ result = Note.TITLE_PATTERN.search( contents )
if result:
self.__title = result.groups()[ 0 ]
diff --git a/model/Notebook.py b/model/Notebook.py
index b1792c7..b20256a 100644
--- a/model/Notebook.py
+++ b/model/Notebook.py
@@ -1,23 +1,32 @@
from copy import copy
-from Entry import Entry
+from Note import Note
from Persistent import Persistent
class Notebook( Persistent ):
+ def __setstate__(self, state):
+ if "_Notebook__entries" in state:
+ state[ "_Notebook__notes" ] = state[ "_Notebook__entries" ]
+ del( state[ "_Notebook__entries" ] )
+ if "_Notebook__startup_entries" in state:
+ state[ "_Notebook__startup_notes" ] = state[ "_Notebook__startup_entries" ]
+ del( state[ "_Notebook__startup_entries" ] )
+ self.__dict__.update(state)
+
"""
- A collection of wiki entries.
+ A collection of wiki notes.
"""
- class UnknownEntryError( ValueError ):
+ class UnknownNoteError( ValueError ):
"""
- Indicates that an accessed entry is not in this notebook.
+ Indicates that an accessed note is not in this notebook.
"""
- def __init__( self, entry_id ):
- ValueError.__init__( self, entry_id )
+ def __init__( self, note_id ):
+ ValueError.__init__( self, note_id )
def __init__( self, id, name ):
"""
- Create a new entry with the given id and name.
+ Create a new note with the given id and name.
@type id: unicode
@param id: id of the notebook
@@ -28,117 +37,117 @@ class Notebook( Persistent ):
"""
Persistent.__init__( self, id )
self.__name = name
- self.__entries = {} # map of entry id to entry
- self.__titles = {} # map of entry title to entry
- self.__startup_entries = [] # list of entries shown on startup
+ self.__notes = {} # map of note id to note
+ self.__titles = {} # map of note title to note
+ self.__startup_notes = [] # list of notes shown on startup
- def add_entry( self, entry ):
+ def add_note( self, note ):
"""
- Add an entry to this notebook.
+ Add an note to this notebook.
- @type entry: Entry
- @param entry: entry to add
+ @type note: Note
+ @param note: note to add
"""
self.update_revision()
- self.__entries[ entry.object_id ] = entry
- self.__titles[ entry.title ] = entry
+ self.__notes[ note.object_id ] = note
+ self.__titles[ note.title ] = note
- def remove_entry( self, entry ):
+ def remove_note( self, note ):
"""
- Remove an entry from this notebook.
+ Remove an note from this notebook.
- @type entry: Entry
- @param entry: entry to remove
+ @type note: Note
+ @param note: note to remove
@rtype: bool
- @return: True if the entry was removed, False if the entry wasn't in this notebook
+ @return: True if the note was removed, False if the note wasn't in this notebook
"""
- if self.__entries.pop( entry.object_id, None ):
+ if self.__notes.pop( note.object_id, None ):
self.update_revision()
- self.__titles.pop( entry.title, None )
- if entry in self.__startup_entries:
- self.__startup_entries.remove( entry )
+ self.__titles.pop( note.title, None )
+ if note in self.__startup_notes:
+ self.__startup_notes.remove( note )
return True
return False
- def lookup_entry( self, entry_id ):
+ def lookup_note( self, note_id ):
"""
- Return the entry in this notebook with the given id.
+ Return the note in this notebook with the given id.
- @type entry_id: unicode
- @param entry_id: id of the entry to return
- @rtype: Entry or NoneType
- @return: entry corresponding to the entry id or None
+ @type note_id: unicode
+ @param note_id: id of the note to return
+ @rtype: Note or NoneType
+ @return: note corresponding to the note id or None
"""
- return self.__entries.get( entry_id )
+ return self.__notes.get( note_id )
- def lookup_entry_by_title( self, title ):
+ def lookup_note_by_title( self, title ):
"""
- Return the entry in this notebook with the given title.
+ Return the note in this notebook with the given title.
@type title: unicode
- @param title: title of the entry to return
- @rtype: Entry or NoneType
- @return: entry corresponding to the title or None
+ @param title: title of the note to return
+ @rtype: Note or NoneType
+ @return: note corresponding to the title or None
"""
return self.__titles.get( title )
- def update_entry( self, entry, contents ):
+ def update_note( self, note, contents ):
"""
- Update the given entry with new contents. Bail if the entry's contents are unchanged.
+ Update the given note with new contents. Bail if the note's contents are unchanged.
- @type entry: Entry
- @param entry: entry to update
+ @type note: Note
+ @param note: note to update
@type contents: unicode
- @param contents: new textual contents for the entry
- @raises UnknownEntryError: entry to update is not in this notebook
+ @param contents: new textual contents for the note
+ @raises UnknownNoteError: note to update is not in this notebook
"""
- old_entry = self.__entries.get( entry.object_id )
- if old_entry is None:
- raise Notebook.UnknownEntryError( entry.object_id )
+ old_note = self.__notes.get( note.object_id )
+ if old_note is None:
+ raise Notebook.UnknownNoteError( note.object_id )
- if contents == old_entry.contents:
+ if contents == old_note.contents:
return
self.update_revision()
- self.__titles.pop( entry.title, None )
+ self.__titles.pop( note.title, None )
- entry.contents = contents
+ note.contents = contents
- self.__titles[ entry.title ] = entry
+ self.__titles[ note.title ] = note
- def add_startup_entry( self, entry ):
+ def add_startup_note( self, note ):
"""
- Add the given entry to be shown on startup. It must already be an entry in this notebook.
+ Add the given note to be shown on startup. It must already be an note in this notebook.
- @type entry: unicode
- @param entry: entry to be added for startup
+ @type note: unicode
+ @param note: note to be added for startup
@rtype: bool
- @return: True if the entry was added for startup
- @raises UnknownEntryError: given entry is not in this notebook
+ @return: True if the note was added for startup
+ @raises UnknownNoteError: given note is not in this notebook
"""
- if self.__entries.get( entry.object_id ) is None:
- raise Notebook.UnknownEntryError( entry.object_id )
+ if self.__notes.get( note.object_id ) is None:
+ raise Notebook.UnknownNoteError( note.object_id )
- if not entry in self.__startup_entries:
+ if not note in self.__startup_notes:
self.update_revision()
- self.__startup_entries.append( entry )
+ self.__startup_notes.append( note )
return True
return False
- def remove_startup_entry( self, entry ):
+ def remove_startup_note( self, note ):
"""
- Remove the given entry from being shown on startup.
+ Remove the given note from being shown on startup.
- @type entry: unicode
- @param entry: entry to be removed from startup
+ @type note: unicode
+ @param note: note to be removed from startup
@rtype: bool
- @return: True if the entry was removed from startup
+ @return: True if the note was removed from startup
"""
- if entry in self.__startup_entries:
+ if note in self.__startup_notes:
self.update_revision()
- self.__startup_entries.remove( entry )
+ self.__startup_notes.remove( note )
return True
return False
@@ -147,7 +156,7 @@ class Notebook( Persistent ):
d = Persistent.to_dict( self )
d.update( dict(
name = self.__name,
- startup_entries = copy( self.startup_entries ),
+ startup_notes = copy( self.startup_notes ),
read_write = True,
) )
@@ -158,5 +167,5 @@ class Notebook( Persistent ):
self.update_revision()
name = property( lambda self: self.__name, __set_name )
- startup_entries = property( lambda self: copy( self.__startup_entries ) )
- entries = property( lambda self: self.__entries.values() )
+ startup_notes = property( lambda self: copy( self.__startup_notes ) )
+ notes = property( lambda self: self.__notes.values() )
diff --git a/model/Read_only_notebook.py b/model/Read_only_notebook.py
index 8c33c82..b79913d 100644
--- a/model/Read_only_notebook.py
+++ b/model/Read_only_notebook.py
@@ -9,11 +9,11 @@ class Read_only_notebook( Persistent ):
Persistent.__init__( self, id )
self.__wrapped = notebook
- def lookup_entry( self, entry_id ):
- return self.__wrapped.lookup_entry( entry_id )
+ def lookup_note( self, note_id ):
+ return self.__wrapped.lookup_note( note_id )
- def lookup_entry_by_title( self, title ):
- return self.__wrapped.lookup_entry_by_title( title )
+ def lookup_note_by_title( self, title ):
+ return self.__wrapped.lookup_note_by_title( title )
def to_dict( self ):
d = self.__wrapped.to_dict()
@@ -25,5 +25,5 @@ class Read_only_notebook( Persistent ):
return d
name = property( lambda self: self.__wrapped.name )
- entries = property( lambda self: self.__wrapped.entries )
- startup_entries = property( lambda self: self.__wrapped.startup_entries )
+ notes = property( lambda self: self.__wrapped.notes )
+ startup_notes = property( lambda self: self.__wrapped.startup_notes )
diff --git a/model/test/Test_entry.py b/model/test/Test_entry.py
deleted file mode 100644
index 7c218b8..0000000
--- a/model/test/Test_entry.py
+++ /dev/null
@@ -1,44 +0,0 @@
-from model.Entry import Entry
-
-
-class Test_entry( object ):
- def setUp( self ):
- self.object_id = 17
- self.title = u"title goes here"
- self.contents = u"%s
blah" % self.title
-
- self.entry = Entry( self.object_id, self.contents )
-
- def test_create( self ):
- assert self.entry.object_id == self.object_id
- assert self.entry.contents == self.contents
- assert self.entry.title == self.title
-
- def test_set_contents( self ):
- new_title = u"new title"
- new_contents = u"%s
new blah" % new_title
- previous_revision = self.entry.revision
-
- self.entry.contents = new_contents
-
- assert self.entry.contents == new_contents
- assert self.entry.title == new_title
- assert self.entry.revision > previous_revision
-
- def test_set_contents_with_html_title( self ):
- new_title = u"new title"
- new_contents = u"%s
new blah" % new_title
- previous_revision = self.entry.revision
-
- self.entry.contents = new_contents
-
- assert self.entry.contents == new_contents
- assert self.entry.title == new_title
- assert self.entry.revision > previous_revision
-
- def test_to_dict( self ):
- d = self.entry.to_dict()
-
- assert d.get( "contents" ) == self.contents
- assert d.get( "title" ) == self.title
-
diff --git a/model/test/Test_note.py b/model/test/Test_note.py
new file mode 100644
index 0000000..c62f40d
--- /dev/null
+++ b/model/test/Test_note.py
@@ -0,0 +1,44 @@
+from model.Note import Note
+
+
+class Test_note( object ):
+ def setUp( self ):
+ self.object_id = 17
+ self.title = u"title goes here"
+ self.contents = u"%s
blah" % self.title
+
+ self.note = Note( self.object_id, self.contents )
+
+ def test_create( self ):
+ assert self.note.object_id == self.object_id
+ assert self.note.contents == self.contents
+ assert self.note.title == self.title
+
+ def test_set_contents( self ):
+ new_title = u"new title"
+ new_contents = u"%s
new blah" % new_title
+ previous_revision = self.note.revision
+
+ self.note.contents = new_contents
+
+ assert self.note.contents == new_contents
+ assert self.note.title == new_title
+ assert self.note.revision > previous_revision
+
+ def test_set_contents_with_html_title( self ):
+ new_title = u"new title"
+ new_contents = u"%s
new blah" % new_title
+ previous_revision = self.note.revision
+
+ self.note.contents = new_contents
+
+ assert self.note.contents == new_contents
+ assert self.note.title == new_title
+ assert self.note.revision > previous_revision
+
+ def test_to_dict( self ):
+ d = self.note.to_dict()
+
+ assert d.get( "contents" ) == self.contents
+ assert d.get( "title" ) == self.title
+
diff --git a/model/test/Test_notebook.py b/model/test/Test_notebook.py
index 298601c..6c42527 100644
--- a/model/test/Test_notebook.py
+++ b/model/test/Test_notebook.py
@@ -1,6 +1,6 @@
from nose.tools import raises
from model.Notebook import Notebook
-from model.Entry import Entry
+from model.Note import Note
class Test_notebook( object ):
@@ -9,7 +9,7 @@ class Test_notebook( object ):
self.name = u"my notebook"
self.notebook = Notebook( self.object_id, self.name )
- self.entry = Entry( 18, u"title
blah" )
+ self.note = Note( 18, u"title
blah" )
def test_create( self ):
assert self.notebook.object_id == self.object_id
@@ -23,154 +23,154 @@ class Test_notebook( object ):
assert self.notebook.name == new_name
assert self.notebook.revision > previous_revision
- def test_add_and_lookup_entry( self ):
+ def test_add_and_lookup_note( self ):
previous_revision = self.notebook.revision
- self.notebook.add_entry( self.entry )
+ self.notebook.add_note( self.note )
assert self.notebook.revision > previous_revision
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == self.entry
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == self.note
- def test_lookup_unknown_entry( self ):
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == None
+ def test_lookup_unknown_note( self ):
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == None
- def test_add_and_lookup_entry_by_title( self ):
+ def test_add_and_lookup_note_by_title( self ):
previous_revision = self.notebook.revision
- self.notebook.add_entry( self.entry )
+ self.notebook.add_note( self.note )
assert self.notebook.revision > previous_revision
- entry = self.notebook.lookup_entry_by_title( self.entry.title )
- assert entry == self.entry
+ note = self.notebook.lookup_note_by_title( self.note.title )
+ assert note == self.note
- def test_lookup_unknown_entry_by_title( self ):
- entry = self.notebook.lookup_entry( self.entry.title )
- assert entry == None
+ def test_lookup_unknown_note_by_title( self ):
+ note = self.notebook.lookup_note( self.note.title )
+ assert note == None
- def test_remove_entry( self ):
+ def test_remove_note( self ):
previous_revision = self.notebook.revision
- self.notebook.add_entry( self.entry )
- result = self.notebook.remove_entry( self.entry )
+ self.notebook.add_note( self.note )
+ result = self.notebook.remove_note( self.note )
assert result == True
assert self.notebook.revision > previous_revision
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == None
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == None
- entry = self.notebook.lookup_entry_by_title( self.entry.title )
- assert entry == None
+ note = self.notebook.lookup_note_by_title( self.note.title )
+ assert note == None
- assert not entry in self.notebook.startup_entries
+ assert not note in self.notebook.startup_notes
- def test_remove_unknown_entry( self ):
+ def test_remove_unknown_note( self ):
revision = self.notebook.revision
- result = self.notebook.remove_entry( self.entry )
+ result = self.notebook.remove_note( self.note )
assert result == False
assert self.notebook.revision == revision
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == None
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == None
- def test_update_entry( self ):
- self.notebook.add_entry( self.entry )
- old_title = self.entry.title
+ def test_update_note( self ):
+ self.notebook.add_note( self.note )
+ old_title = self.note.title
new_title = u"new title"
new_contents = u"%s
new blah" % new_title
previous_revision = self.notebook.revision
- self.notebook.update_entry( self.entry, new_contents )
+ self.notebook.update_note( self.note, new_contents )
- assert self.entry.contents == new_contents
- assert self.entry.title == new_title
+ assert self.note.contents == new_contents
+ assert self.note.title == new_title
assert self.notebook.revision > previous_revision
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == self.entry
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == self.note
- entry = self.notebook.lookup_entry_by_title( old_title )
- assert entry == None
+ note = self.notebook.lookup_note_by_title( old_title )
+ assert note == None
- entry = self.notebook.lookup_entry_by_title( new_title )
- assert entry == self.entry
+ note = self.notebook.lookup_note_by_title( new_title )
+ assert note == self.note
- def test_update_unrevised_entry( self ):
- self.notebook.add_entry( self.entry )
- old_title = self.entry.title
+ def test_update_unrevised_note( self ):
+ self.notebook.add_note( self.note )
+ old_title = self.note.title
revision = self.notebook.revision
- self.notebook.update_entry( self.entry, self.entry.contents )
+ self.notebook.update_note( self.note, self.note.contents )
assert self.notebook.revision == revision
- entry = self.notebook.lookup_entry( self.entry.object_id )
- assert entry == self.entry
+ note = self.notebook.lookup_note( self.note.object_id )
+ assert note == self.note
- @raises( Notebook.UnknownEntryError )
- def test_update_unknown_entry( self ):
+ @raises( Notebook.UnknownNoteError )
+ def test_update_unknown_note( self ):
new_contents = u"new title
new blah"
- self.notebook.update_entry( self.entry, new_contents )
+ self.notebook.update_note( self.note, new_contents )
- def test_add_startup_entry( self ):
- self.notebook.add_entry( self.entry )
+ def test_add_startup_note( self ):
+ self.notebook.add_note( self.note )
previous_revision = self.notebook.revision
- self.notebook.add_startup_entry( self.entry )
+ self.notebook.add_startup_note( self.note )
- assert self.entry in self.notebook.startup_entries
+ assert self.note in self.notebook.startup_notes
assert self.notebook.revision > previous_revision
- def test_add_duplicate_startup_entry( self ):
- self.notebook.add_entry( self.entry )
+ def test_add_duplicate_startup_note( self ):
+ self.notebook.add_note( self.note )
previous_revision = self.notebook.revision
- self.notebook.add_startup_entry( self.entry )
+ self.notebook.add_startup_note( self.note )
- assert self.entry in self.notebook.startup_entries
+ assert self.note in self.notebook.startup_notes
assert self.notebook.revision > previous_revision
revision = self.notebook.revision
- self.notebook.add_startup_entry( self.entry )
+ self.notebook.add_startup_note( self.note )
- assert self.notebook.startup_entries.count( self.entry ) == 1
+ assert self.notebook.startup_notes.count( self.note ) == 1
assert self.notebook.revision == revision
- @raises( Notebook.UnknownEntryError )
- def test_add_unknown_startup_entry( self ):
- self.notebook.add_startup_entry( self.entry )
+ @raises( Notebook.UnknownNoteError )
+ def test_add_unknown_startup_note( self ):
+ self.notebook.add_startup_note( self.note )
- def test_remove_startup_entry( self ):
- self.notebook.add_entry( self.entry )
- self.notebook.add_startup_entry( self.entry )
+ def test_remove_startup_note( self ):
+ self.notebook.add_note( self.note )
+ self.notebook.add_startup_note( self.note )
previous_revision = self.notebook.revision
- result = self.notebook.remove_startup_entry( self.entry )
+ result = self.notebook.remove_startup_note( self.note )
assert result == True
- assert not self.entry in self.notebook.startup_entries
+ assert not self.note in self.notebook.startup_notes
assert self.notebook.revision > previous_revision
- def test_remove_unknown_startup_entry( self ):
- self.notebook.add_entry( self.entry )
+ def test_remove_unknown_startup_note( self ):
+ self.notebook.add_note( self.note )
revision = self.notebook.revision
- result = self.notebook.remove_startup_entry( self.entry )
+ result = self.notebook.remove_startup_note( self.note )
assert result == False
- assert not self.entry in self.notebook.startup_entries
+ assert not self.note in self.notebook.startup_notes
assert self.notebook.revision == revision
def test_to_dict( self ):
d = self.notebook.to_dict()
assert d.get( "name" ) == self.name
- assert d.get( "startup_entries" ) == []
+ assert d.get( "startup_notes" ) == []
assert d.get( "read_write" ) == True
- def test_to_dict_with_startup_entries( self ):
- self.notebook.add_entry( self.entry )
- self.notebook.add_startup_entry( self.entry )
+ def test_to_dict_with_startup_notes( self ):
+ self.notebook.add_note( self.note )
+ self.notebook.add_startup_note( self.note )
d = self.notebook.to_dict()
assert d.get( "name" ) == self.name
- assert d.get( "startup_entries" ) == [ self.entry ]
+ assert d.get( "startup_notes" ) == [ self.note ]
assert d.get( "read_write" ) == True
diff --git a/model/test/Test_read_only_notebook.py b/model/test/Test_read_only_notebook.py
index 1f5655a..287dc6c 100644
--- a/model/test/Test_read_only_notebook.py
+++ b/model/test/Test_read_only_notebook.py
@@ -1,7 +1,7 @@
from nose.tools import raises
from model.Notebook import Notebook
from model.Read_only_notebook import Read_only_notebook
-from model.Entry import Entry
+from model.Note import Note
class Test_read_only_notebook( object ):
@@ -11,59 +11,59 @@ class Test_read_only_notebook( object ):
self.name = u"my notebook"
self.notebook = Notebook( self.object_id, self.name )
- self.entry = Entry( "18", u"title
blah" )
- self.notebook.add_entry( self.entry )
- self.notebook.add_startup_entry( self.entry )
+ self.note = Note( "18", u"title
blah" )
+ self.notebook.add_note( self.note )
+ self.notebook.add_startup_note( self.note )
self.read_only = Read_only_notebook( self.read_only_id, self.notebook )
def test_create( self ):
assert self.read_only.object_id == self.read_only_id
assert self.read_only.name == self.name
- assert self.read_only.entries == [ self.entry ]
- assert self.read_only.startup_entries == [ self.entry ]
+ assert self.read_only.notes == [ self.note ]
+ assert self.read_only.startup_notes == [ self.note ]
@raises( AttributeError )
def test_set_name( self ):
self.read_only.name = u"my new notebook"
@raises( AttributeError )
- def test_add_entry( self ):
- self.read_only.add_entry( self.entry )
+ def test_add_note( self ):
+ self.read_only.add_note( self.note )
- def test_lookup_entry( self ):
- entry = self.read_only.lookup_entry( self.entry.object_id )
- assert entry == self.entry
+ def test_lookup_note( self ):
+ note = self.read_only.lookup_note( self.note.object_id )
+ assert note == self.note
- def test_lookup_unknown_entry( self ):
- entry = self.read_only.lookup_entry( "55" )
- assert entry == None
+ def test_lookup_unknown_note( self ):
+ note = self.read_only.lookup_note( "55" )
+ assert note == None
- def test_lookup_entry_by_title( self ):
- entry = self.read_only.lookup_entry_by_title( self.entry.title )
- assert entry == self.entry
+ def test_lookup_note_by_title( self ):
+ note = self.read_only.lookup_note_by_title( self.note.title )
+ assert note == self.note
- def test_lookup_unknown_entry_by_title( self ):
- entry = self.read_only.lookup_entry( self.entry.title )
- assert entry == None
+ def test_lookup_unknown_note_by_title( self ):
+ note = self.read_only.lookup_note( self.note.title )
+ assert note == None
@raises( AttributeError )
- def test_remove_entry( self ):
- self.read_only.remove_entry( self.entry )
+ def test_remove_note( self ):
+ self.read_only.remove_note( self.note )
@raises( AttributeError )
- def test_update_entry( self ):
+ def test_update_note( self ):
new_title = u"new title"
new_contents = u"%s
new blah" % new_title
- self.read_only.update_entry( self.entry, new_contents )
+ self.read_only.update_note( self.note, new_contents )
@raises( AttributeError )
- def test_add_startup_entry( self ):
- self.read_only.add_startup_entry( self.entry )
+ def test_add_startup_note( self ):
+ self.read_only.add_startup_note( self.note )
@raises( AttributeError )
- def test_remove_startup_entry( self ):
- self.read_only.remove_startup_entry( self.entry )
+ def test_remove_startup_note( self ):
+ self.read_only.remove_startup_note( self.note )
def test_to_dict( self ):
d = self.read_only.to_dict()
diff --git a/static/css/download.css b/static/css/download.css
index 907f12e..58f5c4d 100644
--- a/static/css/download.css
+++ b/static/css/download.css
@@ -10,7 +10,7 @@ body {
width: 50em;
}
-.entry_frame {
+.note_frame {
text-align: left;
margin: 0em;
padding: 1.25em;
diff --git a/static/css/entry.css b/static/css/note.css
similarity index 100%
rename from static/css/entry.css
rename to static/css/note.css
diff --git a/static/css/style.css b/static/css/style.css
index 2752471..9ebb219 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -133,19 +133,19 @@ a:hover {
font-size: 0.75em;
}
-#entries {
+#notes {
text-align: left;
margin-top: 1em;
margin-bottom: 1em;
}
-.entry_controls {
+.note_controls {
float: right;
margin-right: 1.5em;
font-size: 0.75em;
}
-.entry_button {
+.note_button {
border-style: outset;
border-width: 0px;
background-color: #d0e0f0;
@@ -155,11 +155,11 @@ a:hover {
-webkit-border-radius: 0.25em;
}
-.entry_button:hover {
+.note_button:hover {
background-color: #ffcc66;
}
-.entry_frame {
+.note_frame {
margin: 0em;
padding: 0em;
overflow: hidden;
@@ -172,7 +172,7 @@ a:hover {
-webkit-border-radius: 0.5em;
}
-.focused_entry_frame {
+.focused_note_frame {
border: 2px solid black;
}
diff --git a/static/html/features.html b/static/html/features.html
index 8eb4e01..a2dfa49 100644
--- a/static/html/features.html
+++ b/static/html/features.html
@@ -8,13 +8,13 @@ Here's what makes Luminotes so great:
-With Luminotes, you can update any wiki entry without having to switch to
+With Luminotes, you can update any wiki note without having to switch to
a separate edit mode. And you can forget about markup or markdown.
-Deal with several wiki entries all at once on the same page. Perfect for notes
-and brainstorming.
@@ -24,7 +24,7 @@ wherever you go.
You like spaces? So do we. Smashed together titles are completely unnecessary.
-You're free to title your wiki entries as you see fit.
@@ -33,5 +33,5 @@ A single search looks through every word in the entire wiki.login
-No account yet? Want to make a wiki? You can try it out for free.
+No account yet? Want to make a wiki? You can try it out for free.
diff --git a/static/html/navigation.html b/static/html/navigation.html
index 54f4abd..d3a3c7a 100644
--- a/static/html/navigation.html
+++ b/static/html/navigation.html
@@ -1,5 +1,5 @@
-about -
-features -
-take a tour -
-try it out -
-login
+about -
+features -
+take a tour -
+try it out -
+login
diff --git a/static/html/supported browsers.html b/static/html/supported browsers.html
index a55fb41..d24dd99 100644
--- a/static/html/supported browsers.html
+++ b/static/html/supported browsers.html
@@ -1,7 +1,7 @@
supported browsers
Here's how to get started with your personal wiki notebook.
First, the basics. A Luminotes notebook is simply a collection of -linked entries, each with a unique title. Right now you're reading an entry -titled "welcome to your wiki".
+linked notes, each with a unique title. Right now you're reading a note titled +"welcome to your wiki". -To make a new wiki entry, hit the "+" button on the left, or click -anywhere on the page's background. Start by typing a title for your new entry, -say, "ideas", and then press enter. Next, type the contents of your new entry, +
To make a new wiki note, hit the "+" button on the left, or click +anywhere on the page's background. Start by typing a title for your new note, +say, "ideas", and then press enter. Next, type the contents of your new note, using the formatting buttons on the left for things like bold, italics, or lists.
-To link one entry to another, use the entry link button with the -arrow on it. Hit the button once, type the title of an entry you want to link -to, and then hit the button again. Or, if you've already typed some text, you -can select it with your mouse and then hit the entry link button.
+To link one note to another, use the note link button with the arrow +on it. Hit the button once, type the title of a note you want to link to, and +then hit the button again. Or, if you've already typed some text, you can +select it with your mouse and then hit the note link button.
-To follow a link to another entry, just click on it and it will open -up for you to view or edit. You can switch between entries just by clicking on -them, and hide entries simply by clicking the "hide" button.
+To follow a link to another note, just click on it and it will open +up for you to view or edit. You can switch between notes just by clicking on +them, and hide notes simply by clicking the "hide" button.
That's all you need to know to get started with your personal wiki. It's that easy. Enjoy!
diff --git a/static/js/Editor.js b/static/js/Editor.js index 15cbccd..58861de 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -1,23 +1,23 @@ -entry_titles = {} // map from entry title to the open editor for that entry +note_titles = {} // map from note title to the open editor for that note -function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, highlight, focus ) { - this.initial_text = entry_text; +function Editor( id, note_text, insert_after_iframe_id, read_write, startup, highlight, focus ) { + this.initial_text = note_text; this.id = id; this.read_write = read_write; - this.startup = startup || false; // whether this Editor is for a startup entry + this.startup = startup || false; // whether this Editor is for a startup note this.init_highlight = highlight || false; this.init_focus = focus || false; - var iframe_id = "entry_" + id; + var iframe_id = "note_" + id; var self = this; this.document = null; this.iframe = createDOM( "iframe", { - "src": "/notebooks/blank_entry/" + id, + "src": "/notebooks/blank_note/" + id, "frameBorder": "0", "scrolling": "no", "id": iframe_id, "name": iframe_id, - "class": "entry_frame" + "class": "note_frame" } ); this.iframe.editor = this; this.title = null; @@ -25,19 +25,19 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi if ( read_write ) { this.delete_button = createDOM( "input", { "type": "button", - "class": "entry_button", + "class": "note_button", "id": "delete_" + iframe_id, "value": "delete", - "title": "delete entry [ctrl-d]" + "title": "delete note [ctrl-d]" } ); connect( this.delete_button, "onclick", function ( event ) { signal( self, "delete_clicked", event ); } ); this.options_button = createDOM( "input", { "type": "button", - "class": "entry_button", + "class": "note_button", "id": "options_" + iframe_id, "value": "options", - "title": "entry options" + "title": "note options" } ); connect( this.options_button, "onclick", function ( event ) { signal( self, "options_clicked", event ); } ); } @@ -45,15 +45,15 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi if ( read_write || !startup ) { this.hide_button = createDOM( "input", { "type": "button", - "class": "entry_button", + "class": "note_button", "id": "hide_" + iframe_id, "value": "hide", - "title": "hide entry [ctrl-h]" + "title": "hide note [ctrl-h]" } ); connect( this.hide_button, "onclick", function ( event ) { signal( self, "hide_clicked", event ); } ); } - this.entry_controls = createDOM( "span", { "class": "entry_controls" }, + this.note_controls = createDOM( "span", { "class": "note_controls" }, this.delete_button ? this.delete_button : null, this.delete_button ? " " : null, this.options_button ? this.options_button : null, @@ -64,18 +64,18 @@ function Editor( id, entry_text, insert_after_iframe_id, read_write, startup, hi // if an iframe has been given to insert this new editor after, then insert the new editor's // iframe. otherwise just append the iframe for the new editor if ( insert_after_iframe_id ) { - insertSiblingNodesAfter( insert_after_iframe_id, this.entry_controls ); - insertSiblingNodesAfter( this.entry_controls, this.iframe ); + insertSiblingNodesAfter( insert_after_iframe_id, this.note_controls ); + insertSiblingNodesAfter( this.note_controls, this.iframe ); } else { - appendChildNodes( "entries", this.entry_controls ); - appendChildNodes( "entries", this.iframe ); + appendChildNodes( "notes", this.note_controls ); + appendChildNodes( "notes", this.iframe ); } } // second stage of construction, invoked by the iframe's body onload handler. do not call directly. // four-stage construction is only necessary because IE is such a piece of shit function editor_loaded( id ) { - var iframe = getElement( "entry_" + id ); + var iframe = getElement( "note_" + id ); setTimeout( function () { iframe.editor.init_document(); }, 1 ); } @@ -121,7 +121,7 @@ Editor.prototype.finish_init = function () { connect( this.document.body, "onblur", function ( event ) { self.blurred( event ); } ); connect( this.document.body, "onfocus", function ( event ) { self.focused( event ); } ); - // special-case: connect any submit buttons within the contents of this entry + // special-case: connect any submit buttons within the contents of this note var signup_button = withDocument( this.document, function () { return getElement( "signup_button" ); } ); if ( signup_button ) { var signup_form = withDocument( this.document, function () { return getElement( "signup_form" ); } ); @@ -256,24 +256,24 @@ Editor.prototype.mouse_clicked = function ( event ) { var id; var link_title = scrapeText( link ); - var editor = entry_titles[ link_title ]; + var editor = note_titles[ link_title ]; var href_leaf = link.href.split( "/" ).pop(); - // if the link's title corresponds to an open entry id, set that as the link's destination + // if the link's title corresponds to an open note id, set that as the link's destination if ( editor ) { id = editor.id; - link.href = "/entries/" + id; - // if this is a new link, get a new entry id and set it for the link's destination + link.href = "/notes/" + id; + // if this is a new link, get a new note id and set it for the link's destination } else if ( href_leaf == "new" ) { signal( this, "load_editor_by_title", link_title, this.iframe.id ); return; // otherwise, use the id from link's current destination } else { - // the last part of the current link's href is the entry id + // the last part of the current link's href is the note id id = href_leaf; } - // find the entry corresponding to the linked id, or create a new entry - var iframe = getElement( "entry_" + id ); + // find the note corresponding to the linked id, or create a new note + var iframe = getElement( "note_" + id ); if ( iframe ) { iframe.editor.highlight(); return; @@ -283,18 +283,18 @@ Editor.prototype.mouse_clicked = function ( event ) { } Editor.prototype.scrape_title = function () { - // scrape the entry title out of the editor + // scrape the note title out of the editor var heading = getFirstElementByTagAndClassName( "h3", null, this.document ); if ( !heading ) return; var title = scrapeText( heading ); - // delete the previous title (if any) from the entry_titles map + // delete the previous title (if any) from the note_titles map if ( this.title ) - delete entry_titles[ this.title ]; + delete note_titles[ this.title ]; - // record the new title in entry_titles + // record the new title in note_titles this.title = title; - entry_titles[ this.title ] = this; + note_titles[ this.title ] = this; } Editor.prototype.focused = function () { @@ -325,13 +325,13 @@ Editor.prototype.start_link = function () { var container = range.startContainer; range.setStart( container, range.startOffset - 1 ); - this.exec_command( "createLink", "/entries/new" ); + this.exec_command( "createLink", "/notes/new" ); container.nodeValue = ""; selection.collapse( container, 0 ); // otherwise, just create a link with the selected text as the link title } else { - this.exec_command( "createLink", "/entries/new" ); + this.exec_command( "createLink", "/notes/new" ); } } else if ( this.document.selection ) { // browsers such as IE var range = this.document.selection.createRange(); @@ -344,7 +344,7 @@ Editor.prototype.start_link = function () { range.select(); } - this.exec_command( "createLink", "/entries/new" ); + this.exec_command( "createLink", "/notes/new" ); } } @@ -422,10 +422,10 @@ Editor.prototype.contents = function () { Editor.prototype.shutdown = function( event ) { if ( this.title ) - delete entry_titles[ this.title ]; + delete note_titles[ this.title ]; var iframe = this.iframe; - var entry_controls = this.entry_controls; + var note_controls = this.note_controls; disconnectAll( this ); disconnectAll( this.delete_button ); disconnectAll( this.options_button ); @@ -435,7 +435,7 @@ Editor.prototype.shutdown = function( event ) { disconnectAll( this.document ); blindUp( iframe, options = { "duration": 0.5, afterFinish: function () { try { - removeElement( entry_controls ); + removeElement( note_controls ); removeElement( iframe ); } catch ( e ) { } } } ); diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 44489d9..de234df 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -5,7 +5,7 @@ function Wiki() { this.notebook = null; this.notebook_id = getElement( "notebook_id" ).value; this.read_write = false; - this.startup_entries = new Array(); // map of startup entries: entry id to bool + this.startup_notes = new Array(); // map of startup notes: note id to bool this.invoker = new Invoker(); connect( this.invoker, "error_message", this, "display_message" ); @@ -45,7 +45,7 @@ Wiki.prototype.display_user = function ( result ) { // display links for current notebook a list of other notebooks that the user has access to var span = createDOM( "span" ); replaceChildNodes( "notebook_area", span ); - appendChildNodes( span, createDOM( "a", { "href": "/notebooks/" + this.notebook_id, "id": "recent_entries_link" }, "recent entries" ) ); + appendChildNodes( span, createDOM( "a", { "href": "/notebooks/" + this.notebook_id, "id": "recent_notes_link" }, "recent notes" ) ); appendChildNodes( span, createDOM( "br" ) ); appendChildNodes( span, createDOM( "a", { "href": "/notebooks/download_html/" + this.notebook_id, "id": "download_html_link" }, "download as html" ) ); @@ -69,9 +69,9 @@ Wiki.prototype.display_user = function ( result ) { appendChildNodes( span, createDOM( "a", { "href": "/", "id": "logout_link" }, "logout" ) ); var self = this; - connect( "recent_entries_link", "onclick", function ( event ) { + connect( "recent_notes_link", "onclick", function ( event ) { self.invoker.invoke( - "/notebooks/recent_entries", "GET", { "notebook_id": self.notebook_id }, + "/notebooks/recent_notes", "GET", { "notebook_id": self.notebook_id }, function( result ) { self.display_search_results( result ); } ); event.stop(); @@ -107,7 +107,7 @@ Wiki.prototype.populate = function ( result ) { connect( "insertUnorderedList", "onclick", function ( event ) { self.toggle_button( event, "insertUnorderedList" ); } ); connect( "insertOrderedList", "onclick", function ( event ) { self.toggle_button( event, "insertOrderedList" ); } ); connect( "createLink", "onclick", this, "toggle_link_button" ); - connect( "newEntry", "onclick", this, "create_blank_editor" ); + connect( "newNote", "onclick", this, "create_blank_editor" ); connect( "html", "onclick", this, "background_clicked" ); // grab the next available object id @@ -116,13 +116,13 @@ Wiki.prototype.populate = function ( result ) { ); } - // create an editor for each startup entry in the received notebook, focusing the first one - for ( var i in this.notebook.startup_entries ) { - var entry = this.notebook.startup_entries[ i ]; - if ( !entry ) continue; - this.startup_entries[ entry.object_id ] = true; + // create an editor for each startup note in the received notebook, focusing the first one + for ( var i in this.notebook.startup_notes ) { + var note = this.notebook.startup_notes[ i ]; + if ( !note ) continue; + this.startup_notes[ note.object_id ] = true; var focus = ( i == 0 ); - this.create_editor( entry.object_id, entry.contents, undefined, undefined, false, focus ); + this.create_editor( note.object_id, note.contents, undefined, undefined, false, focus ); } } @@ -142,7 +142,7 @@ Wiki.prototype.create_blank_editor = function ( event ) { // if there is already a blank editor, then highlight it and bail if ( this.blank_editor_id != null ) { - var blank_iframe_id = "entry_" + this.blank_editor_id; + var blank_iframe_id = "note_" + this.blank_editor_id; var iframe = getElement( blank_iframe_id ); if ( iframe && iframe.editor.empty() ) { iframe.editor.highlight(); @@ -153,43 +153,43 @@ Wiki.prototype.create_blank_editor = function ( event ) { this.blank_editor_id = this.create_editor( undefined, undefined, undefined, undefined, true, true ); } -Wiki.prototype.load_editor = function ( entry_title, insert_after_iframe_id, entry_id ) { +Wiki.prototype.load_editor = function ( note_title, insert_after_iframe_id, note_id ) { var self = this; this.invoker.invoke( - "/notebooks/load_entry", "GET", { + "/notebooks/load_note", "GET", { "notebook_id": this.notebook_id, - "entry_id": entry_id + "note_id": note_id }, - function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, entry_title ); } + function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, note_title ); } ); } -Wiki.prototype.load_editor_by_title = function ( entry_title, insert_after_iframe_id ) { +Wiki.prototype.load_editor_by_title = function ( note_title, insert_after_iframe_id ) { var self = this; this.invoker.invoke( - "/notebooks/load_entry_by_title", "GET", { + "/notebooks/load_note_by_title", "GET", { "notebook_id": this.notebook_id, - "entry_title": entry_title + "note_title": note_title }, - function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, entry_title ); } + function ( result ) { self.parse_loaded_editor( result, insert_after_iframe_id, note_title ); } ); } -Wiki.prototype.parse_loaded_editor = function ( result, insert_after_iframe_id, entry_title ) { - if ( result.entry ) { - var id = result.entry.object_id - var entry_text = result.entry.contents; +Wiki.prototype.parse_loaded_editor = function ( result, insert_after_iframe_id, note_title ) { + if ( result.note ) { + var id = result.note.object_id + var note_text = result.note.contents; } else { var id = null; - var entry_text = "