Oleg Broytmann wrote:
On Wed, May 14, 2008 at 03:58:10PM -0500, Jim Steil wrote:
Oleg Broytmann wrote:
RowCreatedSignal. I was having some issues with the kwargs parm.
Instead of returning a dict with the values of my table, it is returning
a dict with the class, and the keyfield value of the new record. Ex:
{'class': <class 'motion.model.Contact'>, 'id': 11L}
The table's name is kw['class'].sqlmeta.table.
Oleg: When I try this, I get a -- KeyError: 'class' -- exception. But,
I then changed it to kw['sender'].sqlmeta.table and it works fine. Does
that make any sense?
No, I do not understand what is going on. There is the key 'class' in the
dictionary. The word 'sender' is not mentioned in main.py (where the signal
is sent).
Oleg.
Let me elaborate a bit. Maybe some of the other stuff I've done has
messed things up. Here is my full method:
def addListener(newValues, postFunctions, tableName='', **kw):
try:
user = identity.current.user.id
except:
user = None
if tableName == '':
tableName = kw['sender'].sqlmeta.table
cl = ChangeLog(user=user,
tableName=tableName,
operation='INSERT',
columnName='All',
beforeImage='',
afterImage=str(newValues))
I added the tableName parameter for when I'm adding rows to the special
table created for SQLRelatedJoins. When adding rows/removing rows to
those tables, I'm manually calling this method to log my changes. This
same method is called by the RowCreateSignal event.
-Jim
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss