witten
/
luminotes
Archived
1
0
Fork 0

Client code now only calls save_note() on the server when necessary, and

takes startup flag into account.

Fixed unit test for database cache.
This commit is contained in:
Dan Helfman 2008-03-07 23:14:39 +00:00
parent 7a0368b5d9
commit 2b0a9af3e3
4 changed files with 13 additions and 4 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
1.2.5: March 7, 2008
* Fixed a database bug that could have caused a cache save before a commit.
* Client code now only calls save_note() on the server when necessary, and
takes startup flag into account.
1.2.4: March 6, 2008
* New product tour and new screenshots.
* Added a work-around for a database cache bug that prevented the file upload

View File

@ -3,13 +3,13 @@ from pysqlite2 import dbapi2 as sqlite
from datetime import datetime
from Stub_object import Stub_object
from Stub_cache import Stub_cache
from controller.Database import Database
from controller.Database import Database, Connection_wrapper
class Test_database( object ):
def setUp( self ):
# make an in-memory sqlite database to use in place of PostgreSQL during testing
self.connection = sqlite.connect( ":memory:", detect_types = sqlite.PARSE_DECLTYPES | sqlite.PARSE_COLNAMES )
self.connection = Connection_wrapper( sqlite.connect( ":memory:", detect_types = sqlite.PARSE_DECLTYPES | sqlite.PARSE_COLNAMES ) )
self.cache = Stub_cache()
cursor = self.connection.cursor()
cursor.execute( Stub_object.sql_create_table() )

View File

@ -699,6 +699,10 @@ Editor.prototype.mark_clean = function () {
this.initial_text = this.document.body.innerHTML;
}
Editor.prototype.mark_dirty = function () {
this.initial_text = null;
}
// convenience function for parsing a link that has an href URL containing a query string
function parse_query( link ) {
if ( !link || !link.href )

View File

@ -1198,8 +1198,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback ) {
editor = this.focused_editor;
var self = this;
if ( editor && editor.read_write && !( editor.id == this.blank_editor_id && editor.empty() ) && !editor.closed ) {
// if ( editor && editor.read_write && !( editor.id == this.blank_editor_id && editor.empty() ) && !editor.closed && editor.dirty() ) {
if ( editor && editor.read_write && !( editor.id == this.blank_editor_id && editor.empty() ) && !editor.closed && editor.dirty() ) {
this.invoker.invoke( "/notebooks/save_note", "POST", {
"notebook_id": this.notebook_id,
"note_id": editor.id,
@ -2026,6 +2025,7 @@ Options_pulldown.prototype.constructor = Options_pulldown;
Options_pulldown.prototype.startup_clicked = function ( event ) {
this.editor.startup = this.startup_checkbox.checked;
this.editor.mark_dirty();
// save this note along with its toggled startup state
this.wiki.save_editor( this.editor );