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:
parent
7a0368b5d9
commit
2b0a9af3e3
5
NEWS
5
NEWS
|
@ -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
|
1.2.4: March 6, 2008
|
||||||
* New product tour and new screenshots.
|
* New product tour and new screenshots.
|
||||||
* Added a work-around for a database cache bug that prevented the file upload
|
* Added a work-around for a database cache bug that prevented the file upload
|
||||||
|
|
|
@ -3,13 +3,13 @@ from pysqlite2 import dbapi2 as sqlite
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from Stub_object import Stub_object
|
from Stub_object import Stub_object
|
||||||
from Stub_cache import Stub_cache
|
from Stub_cache import Stub_cache
|
||||||
from controller.Database import Database
|
from controller.Database import Database, Connection_wrapper
|
||||||
|
|
||||||
|
|
||||||
class Test_database( object ):
|
class Test_database( object ):
|
||||||
def setUp( self ):
|
def setUp( self ):
|
||||||
# make an in-memory sqlite database to use in place of PostgreSQL during testing
|
# 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()
|
self.cache = Stub_cache()
|
||||||
cursor = self.connection.cursor()
|
cursor = self.connection.cursor()
|
||||||
cursor.execute( Stub_object.sql_create_table() )
|
cursor.execute( Stub_object.sql_create_table() )
|
||||||
|
|
|
@ -699,6 +699,10 @@ Editor.prototype.mark_clean = function () {
|
||||||
this.initial_text = this.document.body.innerHTML;
|
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
|
// convenience function for parsing a link that has an href URL containing a query string
|
||||||
function parse_query( link ) {
|
function parse_query( link ) {
|
||||||
if ( !link || !link.href )
|
if ( !link || !link.href )
|
||||||
|
|
|
@ -1198,8 +1198,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback ) {
|
||||||
editor = this.focused_editor;
|
editor = this.focused_editor;
|
||||||
|
|
||||||
var self = this;
|
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", {
|
this.invoker.invoke( "/notebooks/save_note", "POST", {
|
||||||
"notebook_id": this.notebook_id,
|
"notebook_id": this.notebook_id,
|
||||||
"note_id": editor.id,
|
"note_id": editor.id,
|
||||||
|
@ -2026,6 +2025,7 @@ Options_pulldown.prototype.constructor = Options_pulldown;
|
||||||
|
|
||||||
Options_pulldown.prototype.startup_clicked = function ( event ) {
|
Options_pulldown.prototype.startup_clicked = function ( event ) {
|
||||||
this.editor.startup = this.startup_checkbox.checked;
|
this.editor.startup = this.startup_checkbox.checked;
|
||||||
|
this.editor.mark_dirty();
|
||||||
|
|
||||||
// save this note along with its toggled startup state
|
// save this note along with its toggled startup state
|
||||||
this.wiki.save_editor( this.editor );
|
this.wiki.save_editor( this.editor );
|
||||||
|
|
Reference in New Issue
Block a user