Hi,

I'm writing a web application with web.py and sqlalchemy. I've used
http://webpy.org/cookbook/sqlalchemy as a guide to get me up and
running. As well as code like the tutorial, I've got Models that have
various methods that query the database, and Controllers that consume
them. The methods in my models like something like this:
def add(self):
  web.ctx.orm.add(User('blah'))

They work perfectly fine when called by a Controller, presumably
because the context is flushed out at that time. However, tests always
fail with:
AttributeError: 'ThreadedDict' object has no attribute 'orm'

I've tried all sorts of various hacks and tricks to try and make this
work, to no avail. I _could_ drop all of failing tests, and rely on
the associated Controller tests to catch any issues, but this seems
suboptimal.

Is there a known solution/pattern web.py + sqlalchemy + testing?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to