[SQL-CVS] r4271 - in SQLObject/trunk: docs sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2010-11-13 18:14:41
|
Author: phd
Date: Sat Nov 13 10:46:46 2010
New Revision: 4271
Log:
Major API change: post-functions for all signals are called with the
instance as the first parameter. The following signals were changed:
RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal.
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/events.py
SQLObject/trunk/sqlobject/main.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/docs/News.txt Sat Nov 13 10:46:46 2010 (r4271)
@@ -17,6 +17,10 @@
as the first parameter. The following signals were changed:
RowCreateSignal, RowCreatedSignal, DeleteColumnSignal.
+* Major API change: post-functions for all signals are called with the
+ instance as the first parameter. The following signals were changed:
+ RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal.
+
SQLObject 0.14.1
================
Modified: SQLObject/trunk/sqlobject/events.py
==============================================================================
--- SQLObject/trunk/sqlobject/events.py Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/sqlobject/events.py Sat Nov 13 10:46:46 2010 (r4271)
@@ -100,8 +100,8 @@
class. Arguments are ``(instance, post_funcs)``.
``post_funcs`` is a list of callbacks, intended to have
- functions appended to it, and are called without arguments. If
- any of the post_funcs raises an exception, the deletion is only
+ functions appended to it, and are called with arguments ``(instance)``.
+ If any of the post_funcs raises an exception, the deletion is only
affected if this will prevent a commit.
You cannot cancel the delete, but you can raise an exception (which will
@@ -139,8 +139,10 @@
"""
Called when an instance is updated through a call to ``.set()``
(or a column attribute assignment). The arguments are
- ``(instance)``. This is run *after* the instance is updated;
- Works better with lazyUpdate = True
+ ``(instance, post_funcs)``. ``post_funcs`` is a list of callbacks,
+ intended to have functions appended to it, and are called with the
+ arguments ``(new_instance)``. This is run *after* the instance is
+ updated; Works better with lazyUpdate = True.
"""
class AddColumnSignal(Signal):
Modified: SQLObject/trunk/sqlobject/main.py
==============================================================================
--- SQLObject/trunk/sqlobject/main.py Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/sqlobject/main.py Sat Nov 13 10:46:46 2010 (r4271)
@@ -1001,7 +1001,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def expire(self):
if self.sqlmeta.expired:
@@ -1058,7 +1058,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def set(self, _suppress_set_sig=False, **kw):
if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False) and not _suppress_set_sig:
@@ -1150,7 +1150,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def _SO_selectInit(self, row):
for col, colValue in zip(self.sqlmeta.columnList, row):
@@ -1584,12 +1584,12 @@
self._connection.cache.expire(self.id, self.__class__)
for func in post_funcs:
- func()
+ func(self)
post_funcs = []
self.sqlmeta.send(events.RowDestroyedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def delete(cls, id, connection=None):
obj = cls.get(id, connection=connection)
|