On Nov 29, 2009, at 7:24 PM, Lukasz Szybalski wrote: > On Sun, Nov 29, 2009 at 3:58 PM, Michael Bayer <[email protected]> > wrote: >> >> On Nov 29, 2009, at 2:17 PM, Lukasz Szybalski wrote: >> >>> I guess the proper solution is to setup your python class mapper like >>> this, and use the update method of the __dict__ instead of setattr. >>> >>> class Recall(object): >>> def __init__(self, **kw): >>> self.__dict__.update(kw) >>> pass >> > > mapper(Recall,recall_table) > > then..... > > x=Recall(column1=column1.....) > session.add(Recall) > >> if Recall is ORM-mapped, the above won't work. use setattr(), not __dict__ >> access. > > This seems to work in 0.5.6? Does that change in 0.6? or
its not been safe to modify __dict__ directly since at least 0.3. > > > > Yes. > >>> >>> >>> Lucas >>> >>> On Thu, Nov 26, 2009 at 3:24 PM, Lukasz Szybalski <[email protected]> >>> wrote: >>>> Any idea how should I be set the None Type argument to str.? >>>> >>>> x=Recall() >>>> type(x.MAKETXT) is <type 'NoneType'> >>>> >>>> set in OrmObject when it does the setattr it probably fails because >>>> you cannot setattr on NoneType objects? >>>> >>>> setattr(x.MAKETXT,'somevalue') >> >> don't you mean setattr(x, 'MAKETXT', 'somevalue') here? > > yes....that was my mistake... > > -- > > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
