Accessing relation property after setting foreignkey value doesn't work

Issue #1202 resolved
Former user created an issue

In sa0.4 it was possible to do the following a.ref_b_id = "b_id" (ref_b_id is the foreign key to a B table) a.ref_b. ... (ref_b is the mapper property to b mapped object)

I've attached 2 test files: The first one is for 0.4 (tested with 0.4.8) The second one is for 0.5 (tested on trunk and 0.5rc2)

Comments (5)

  1. Mike Bayer repo owner
    • changed milestone to 0.5.0
    • changed status to resolved
    • changed component to orm

    to be clear, the reason you can access b.a_row here is because it has not yet been accessed at all beforehand. If you were to have accessed it before the flush, it would be initialized to a blank value, and this is the defined behavior for 0.4 and 0.5. c35621969027ae052bdcff98a6c7d30e98e54a0e adds more granularity to 0.5 such that only backref events will initialize attributes and collections on pending objects, but not cascades as in the one which occured in this test during add().

  2. Log in to comment