#30 Fix for plain/nonplain setters during create

closed-accepted
nobody
None
5
2006-01-06
2005-11-30
Luke Opperman
No

Using rev 1326 (probably long before this, found it
during attempting to
migrate an 0.5-based app to svn version). I've attached
a simple test case,
the problem is in main.SQLObject.set. Flow:

1. set plain setters
2. set nonplain setters (in this case, a non-db column)
2a. in the problem scenario, these then set some db columns
2b. which in _SO_setValue add their correct values to
_SO_createValues
3. set then updates _SO_createValues with the original
dict, which has the
default values for the db columns set by the nonplain.

Not sure if there's an intentional reason to delay
populating _SO_createValues,
by moving self._SO_createValues.update(kw) between
steps 1 and 2 the tests pass for me.

This is that simple patch and the associated test.

Discussion

  • Luke Opperman
    Luke Opperman
    2005-11-30

    Diff to main.py

     
    Attachments
  • Oleg Broytman
    Oleg Broytman
    2006-01-06

    • status: open --> closed-accepted
     
  • Oleg Broytman
    Oleg Broytman
    2006-01-06

    Logged In: YES
    user_id=4799

    It seems it's been applied already. Test was renamed to
    test_setters.py.