ah, that is due to the instrumentation of attributes. the "pages" attribute will be created when you first access it normally, as opposed to directly through the object's __dict__ where it doesnt exist yet.
if you say j.pages or getattr(j, 'pages'), then itll magically appear in the __dict__. the attribute instrumentation assumes youre generally not dealing with __dict__ directly, particularly for setting attributes, since youd be skipping the instrumentation step. the instrumentation does a little less now than it did in previous releases but still is pretty important. On Jun 19, 2006, at 5:54 PM, Arnar Birgisson wrote: > On 6/19/06, Michael Bayer <[EMAIL PROTECTED]> wrote: >> hey arnar - >> >> I cant reproduce this one with what youve given me. If i just set up >> "jobs" and "pages" mappers (no page version stuff since its not in >> the example), and dont compile anything, the creation of the Job() >> object compiles the "jobs" mapper which properly hits the "pages" >> backref. > > Hmm.. that is strange. This is a IPython session: > > In [1]: from jobs import * > > In [2]: j = Job('nr1') > > In [3]: dir(j) > Out[3]: > ['_AttributeManager__sa_attr_state', > '_Job__sa_attr_state', > '__class__', > '__delattr__', > '__dict__', > '__doc__', > '__getattribute__', > '__hash__', > '__init__', > '__module__', > '__new__', > '__reduce__', > '__reduce_ex__', > '__repr__', > '__setattr__', > '__str__', > '__weakref__', > '_state', > 'c', > 'created', > 'deleted', > 'jobno'] > > In [4]: 'pages' in dir(j) > Out[4]: False > > In [5]: j2 = Job() > > In [6]: dir(j2) > Out[6]: > ['_Job__sa_attr_state', > '__class__', > '__delattr__', > '__dict__', > '__doc__', > '__getattribute__', > '__hash__', > '__init__', > '__module__', > '__new__', > '__reduce__', > '__reduce_ex__', > '__repr__', > '__setattr__', > '__str__', > '__weakref__', > '_state', > 'c', > 'created', > 'deleted', > 'jobno'] > > In [7]: 'pages' in j2 > ---------------------------------------------------------------------- > ----- > exceptions.TypeError Traceback (most > recent call last) > > /home/arnarb/workdir/softproof/webinterface/softproof/softproof/ > nontgmodel/<ipython > console> > > TypeError: iterable argument required > > In [8]: 'pages' in dir(j2) > Out[8]: False > > In [9]: p = Page() > > In [10]: 'pages' in dir(j2) > Out[10]: True > > > > Only after first referring to Page I get the pages property on Job. > The file jobs.py is attached. I must be doing something wrong because > I pasted your test into a file and ran it, and j.pages showed up just > fine. > > Arnar > <jobs.py> > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users