On 7/14/09 4:00 AM, Alberto Valverde wrote:

> So now I can do:
> # in views/user.py
> class UserController(CrudController):
>      # bunch of class attributes + helper overrides to configure the UI,
> etc...
> # No aliases and no need to make an instance if the constructor take no
> params
> # then in configure.zcml
>    <sigym:crud
>      collection=".interfaces.IUsers"
>      member=".interfaces.IUser"
>      controller=".views.user.UserController"
>      />
> Wow, that was much easier than I expected; it took me more to write this
> email than implementing it ;)

Glad it worked out!

> I am impressed. Next round will be mucking with the zcml directive
> handler so i can pass config. options to the "controller" when it
> initializes it...

This gets a bit dicey, because directive handlers don't support anything like 
**kw (as far as I know) for attribute/value pairs.  Usually it needs to be done 
as subelements, e.g.:

    <option name="foo" value="bar"/>
    <option name="foo2" value="bar2"/>

Unfortunately, the ZCML magic to do this is extremely painful (IMO).  An 
of its usage to support things like (no longer used on the BFG trunk, but 
available for historical consumption):


... is available here:


In particular, search for "zope.configuration.config.GroupingContextDecorator", 
then take a look at the "meta:groupingDecorator" in 
http://svn.repoze.org/repoze.bfg/tags/0.8/repoze/bfg/includes/meta.zcml .


- C

- C
Repoze-dev mailing list

Reply via email to