Le 02/12/2010 15:14, Stéphane Klein a écrit :
Le 02/12/2010 14:59, Stéphane Klein a écrit :
Hi,
in a Pylons Framework project, I've this error :
ProgrammingError: (ProgrammingError) SQLite objects created in a thread
can only be used in that same thread.The object was created in thread id
1091357552 and this is thread id 1099762544
I use a standard sqlalchemy pylons skeleton.
I use "paster serve" to launch my application.
I don't understand where can be my mistake.
Some help about this error message ?
In my configuration ini file, I put :
sqlalchemy.url = sqlite:///%(here)s/development.db?check_same_thread=False
but I don't know if it's the good solution.
This is my mistake :
* I use wtforms and wtforms.ext.sqlalchemy.fields.QuerySelectField
* in "query_factory" attribute I've this :
customer = QuerySelectField(
u'Customer',
query_factory=meta.Session.query(Customer).all,
get_label='display_name',
validators=[validators.Required()]
)
The good code is :
def _get_customer():
return meta.Session.query(Customer).all()
customer = QuerySelectField(
u'Customer',
query_factory=_get_customer,
get_label='display_name',
validators=[validators.Required()]
)
Regards,
Stephane
--
Stéphane Klein <[email protected]> - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com
--
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.