Re: Could it be possible to support configuring with *.cfg instead of *.zcml?

Asko Soukka <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Robert Niederreiter wrote:
>> Maybe zope.configuration could be extended to use venusian.scan to
>> register directives, when there is configure.py in your package..
 >
> This approach sounds nice and may get some positive feedback from the
> plone community. Having all directives available as python function
> calls (without the hassle of configuration context) sounds good.
> Also using venusian for deferred configuration sounds good.
>
> The problem i see here is that there needs to be a generic way of
> wrapping all available directive callbacks in order to avoid another
> registration function signature for each directive.

Yes, multiple issues here:

- how to map directives into decorators
- how to handle directive namespaces
- how to know argument name for the decorated callable in the
   current directive

I made an another naive example, now with venusian configuration:

   https://github.com/datakurre/collective.venusianconfig/

- scanned packages are imported in

 
https://github.com/datakurre/collective.venusianconfig/blob/master/src/collective/venusianconfig/configure.py

- registered callables are decorared with generic 'configure'-decorator

 
https://github.com/datakurre/collective.venusianconfig/blob/master/src/collective/venusianconfig/view.py

   @configure('browser:view:class',  # 'ns:directive:callableargname'
              name='hello-world', context='*', permission='zope2.View')
   class HelloWorld(BrowserView):
       def __call__(self):
           return u"Hello world"

Regards,
Asko

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.