Hello,
I'm using the new sqlalchemy scaffold introduced in pyramid 1.7 and wtforms
to handle my forms.
with this configuration, you have to get the dbsession from the request
object.
In previous versions, you just had to import the DBSession object to use it
in modules.
Here's an example of a pyramid 1.6 usage:
in choices.py:
from myapp.models import DBSession, Country
def country_choices()
countries = DBSession.query(Country).order_by(Country.name)
in forms.py:
from wtforms.form import Form
from wtforms_sqlalchemy.fields import QuerySelectField
class MyForm(Form)
name = TextField(u"name")
country = QuerySelectField(u'country', query_
factory=country_choices)
As you can see, my country_choices method doesn't have access to the
request object.
My question is:
How to handle that kind of usage with the new dbsession management in
alchemy's scaffold?
Thanks,
Jérôme.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pylons-discuss/d8d55e59-31b5-4fc0-b820-4848ea65aa17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.