> On Mar 17, 1:08 pm, Wyatt Baldwin <[email protected]> wrote: > > > On Mar 17, 9:00 am, edgarsmolow <[email protected]> wrote: > > > > I'm trying to get a foothold in Pylons 0.9.7 with SQLAlchemy 0.5, but > > > running into a problem when testing model functionality. In > > > particular, there's a Person object which is supposed to be stored in > > > the persons table. Here's test code snippet: > > > > wilma = model.Person('Wilma','Flintstone') > > > wilma.acct_no = acct_no > > > wilma.gender = 'F' > > > print 'New person:',wilma > > > meta.Session.add(wilma) > > > meta.Session.commit() > > > > This throws an AttributeError exception. I don't understand what > > > ScopedSession is all about and why it has no add attribute. Just > > > trying to follow the tutorial without much luck. > > > > Traceback (most recent call last): > > > File "test2.py", line 35, in <module> > > > meta.Session.add(wilma) > > > AttributeError: 'ScopedSession' object has no attribute 'add' > > > > This exception refers to the next-to-last line of code. > > > Can someone please guide me? > > > Can you show the code where you set up the session? > On Mar 17, 10:14 am, edgarsmolow <[email protected]> wrote: > import sqlalchemy as sa > import w2t.model as model > import w2t.model.meta as meta > > session = meta.Session() > wilma = model.Person('Wilma','Flintstone') > wilma.acct_no = 'SOMEACCOUNTNUMBER' > wilma.gender = 'F' > session.add(wilma) > meta.Session.commit() > > Since neither meta.Session or session have an add method, an > AttributeError exception is raised. But, I don't know the correct set > of calls to make to create a session.
What does the Session setup code in your meta module look like? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
