Oleg Broytmann wrote:
On Wed, May 14, 2008 at 10:37:31AM -0500, Jim Steil wrote:
Is there a way in the RowCreatedSignal event to capture the name of the object (table) that is being inserted into?
[skip]
I've been trying to get my logging working now for the 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?

   -Jim
When I changed the event from RowCreatedSignal to RowCreateSignal, everything worked as expected, with the kwargs argument giving me the values of the new record. Ex: {'changedOn': datetime.datetime(2008, 5, 13, 16, 44, 57, 73000), 'county': '', 'distributor': None, 'city': '', 'district': 58, 'title': '', 'state': '', 'address1': '', 'email': '', 'fax': None, 'mobilePhone': None, 'companyName': '', 'phone2': None, 'phone3': None, 'address2': '', 'phone1': None, 'zipCode': '', 'hardcopyPriceLists': False, 'createdOn': datetime.datetime(2008, 5, 13, 16, 44, 57, 73000), 'pager': None, 'homePhone': None, 'firstName': u'Lou', 'lastName': u'Reichers', 'notes': None, 'customerNumber': None, 'coopId': None, 'emailPriceLists': False}

I was expecting these two events to function the same. Is this a bug in the code, or something that I'm not understanding correctly?

   I think there is a misdesign. All signals should be sent 'self' as the
first parameter (and proper keywords where apropriate). As this would be
a major API change I can't just fix it in the current codebase. Will write
a TODO entry for the trunk; the fix will be in 0.11.

Oleg.

-------------------------------------------------------------------------
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

Reply via email to