[Zope-dev] Re: Strange serializing error when commiting -> zope.sqlalchemy

Hermann Himmelbauer dusty at qwer.tk
Tue Jun 3 08:00:32 EDT 2008


Am Dienstag, 3. Juni 2008 12:21 schrieb Laurence Rowe:
> Laurence Rowe wrote:
> >> I found it by myself: I registered a zope.sqlalchemy related utility,
> >> which stores an engine (self.engine = create_engine(DSN,...)) and a
> >> scoped session (self.Session = scoped_session(sessionmaker...)). These
> >> two objects cannot be serialized, hence the above problem.
> >>
> >> Now I'm unsure what to do about this problem - is there any code
> >> available that demonstrates how to register SA engines/Sessions as
> >> utilities?
> >
> > The simplest solution is to register the Session object as a global
> > utility.
>
> Though that would be quite unnecessary too ;-). If you are ok with one
> global scoped session for your app, then just use `from mymodule import
> Session; session = Session()`.

Hmmm, it's not that easy: I have multiple sites on one Zope3 instance, whereas 
every site should connect to another database. For that reason, I thought 
about a local utility. However, this results in this serialization error.

Best Regards,
Hermann

-- 
hermann at qwer.tk
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope-Dev mailing list