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
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to