On Dec 26, 2010, at 9:02 AM, jerryji wrote:

> BTW, during testing, this _persistent_ user object dropped my jaw --

I think the "user = None" assignment has no effect in pdb since the existing 
contents of locals() is fixed.

Otherwise the "rollback" behavior of your tests is why the PG database has no 
end result for the SQL emitted in the tests.


> 
> """
>> myapp/views/signup.py(73)signup_view()
> -> user = model.User(user_name=user_name, email=email,
> password=password)
> (Pdb) n
> (Pdb) user
> <pweb.models.User object at 0xbbb20ec>
> (Pdb) user = None
> (Pdb) user
> <pweb.models.User object at 0xbbb20ec>
> (Pdb) user2 = model.User(user_name=user_name, email=email,
> password=password)
> (Pdb) user2
> <pweb.models.User object at 0xbbb2f0c>
> (Pdb) user2 = None
> (Pdb) user2
> (Pdb)
> """
> 
> Though I'm not sure if that's related to my problem at hand.
> 
> Jerry
> 
> On Dec 26, 9:55 pm, jerryji <jerryji1...@gmail.com> wrote:
>> Hi,
>> 
>> I have been pulling my hair the whole day today: I have a web
>> application that runs fine, however, during unittest I noticed that
>> the test (PostgreSQL) database is not updated even after I issue the
>> flush() and see the SQL statement, which inserts fine by itself in
>> psql --
>> 
>> """
>> (Pdb) list
>>  73             user = model.User(user_name=user_name, email=email,
>> password=password)
>>  74
>>  75             dbsession = DBSession()
>>  76  ->              dbsession.add(user)
>>  77             try:
>>  78                 dbsession.flush()
>>  79             except:
>>  80                 raise
>> (Pdb) user
>> <myapp.models.User object at 0xa9b8c4c>
>> (Pdb) user.user_name, user.email, user.user_id
>> (u'test', u't...@example.com', u'f24a24217248480d90c1c370c103e07f')
>> (Pdb) n> myapp/views/signup.py(77)signup_view()
>> 
>> -> try:
>> (Pdb) n> myapp/views/signup.py(78)signup_view()
>> 
>> -> dbsession.flush()
>> (Pdb) n
>> ...INFO sqlalchemy.engine.base.Engine.0x...24ac INSERT INTO users
>> (user_id, user_name, email) VALUES (%(user_id)s, %(user_name)s, %
>> (email)s)
>> ...INFO sqlalchemy.engine.base.Engine.0x...24ac {'user_id':
>> u'f24a24217248480d90c1c370c103e07f', 'user_name': u'test', 'email':
>> u't...@example.com'}
>> """
>> 
>> I have dropped all the databases in my computer leaving only the test
>> db just to make absolute sure that I'm not connecting to one database
>> while looking into another.
>> 
>> What could have gone wrong?
>> 
>> Many thanks in advance!
>> 
>> Jerry
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to