[Product-Developers] RFC: Venusian-based Python-syntax alternative for ZCML-configuration

Asko Soukka asko.soukka at iki.fi
Sat Jan 4 17:44:25 UTC 2014


ajung wrote:
> Having a similar functionality like
> @view_request in Pyramid would be cool...

I had an hour in train to try this out. I hope, I understood this correctly.

I tried out a zope.configuration directive with venusian decorator like

@view_configure(name='hello_world', for_='*',
def hello_world(context, request):
     return u"Hello World!"

which would render the returned result, or

@view_configure(name='hello_world', for_='*',
def hello_world(context, request):
      return {'content': u"Hello World!"}

which would render hello_world.pt with u"Hello World!" available at 

Technically, my directive creates a dynamic BrowserView-based class, 
with decorated function as static method, to be called in __call__. 
Quite ok, but the "dynamic class" might be a problem when debugging 
errors. However, this approach allowed me to re-use existing directives 
and I needed only a few new lines of code for this feature.

So, I don't think that zope.configuration is our problem.

We could have @view_configure for Plone if we'd like to (or maybe 
@page_configure to avoid mixing it with Pyramid's view_configure or Zope 
3's "Views", which are different from BrowserPages). But, of course, 
this would not solve our current issue of having already too many ways 
to define Views and easy-to-find documentation for any of them. 
(Luckily, there's documentation sprints coming up this year \o/).


More information about the Product-Developers mailing list