[Zope3-Users] zope.scheduler and triggering actions on local
objects
Alek Kowalczyk
thealx at poczta.onet.pl
Wed Feb 7 16:30:06 EST 2007
Florian Lindner napisał(a):
> You can open a connection to the database and use it this way. Here is an
> example code that works but generated an error ofter some calls:
>
> db = getUtility(ZODB.interfaces.IDatabase)
> conn = db.open()
> root = conn.root().data['Application']
> zope.app.component.hooks.setSite(root)
>
> utils = getUtilitiesFor(IYourInterface)
> for i in utils:
> print "Utility found:", i[0]
>
> db.close()
>
> but after some calls it gives an error:
>
> exceptions.ValueError: I/O operation on closed file
>
> Don't know why.
>
Thanks for the solution! Just change db.close() to conn.close() and the
error is gone :)
Regards!
Alek
More information about the Zope3-users
mailing list