[Grok-dev] setting up local utilities from outside grok

Jasper Spaans j at jasper.es
Thu Jul 9 05:55:13 EDT 2009


Hi list,

I've got a small issue with setting up local utilities on a
grok.Application; I have something like the following:

class MyWonderfulApp(grok.Application):
    grok.local_utility(PluggableAuthentication, provides=IAuthentication,
                       setup=setup_authentication)

This works fine if I instantiate my application through the webinterface.
However, I'd like to be able to instantiate my application using some code
(which doesn't know a lot about grok), where I do something like:


grok.grok('my.app')
root = get_apps_root()  # this sets up the ZODB connection and returns the
                        # root object

if 'test' not in root:
    root['test'] = app = MyWonderfulApp(...)
    ...
    transaction.commit()

The application is available, I can access views, but no sitemanager or
localutil is registered, and my authentication thing is not set up.

Is there an easy way to get this to work?

Cheers,
-- 
Jasper Spaans

Fox-IT Experts in IT Security!
I www.fox-it.com


More information about the Grok-dev mailing list