repoze.bfg 0.8.1 was just released (to the 
http://dist.repoze.org/bfg/current/simple index) with the following features:

- Class objects may now be used as view callables (both via ZCML and
   via use of the ``bfg_view`` decorator in Python 2.6 as a class
   decorator).  The calling semantics when using a class as a view
   callable is similar to that of using a class as a Zope "browser
   view": the class' ``__init__`` must accept two positional parameters
   (conventionally named ``context``, and ``request``).  The resulting
   instance must be callable (it must have a ``__call__`` method).
   When called, the instance should return a response.  For example::

     from webob import Response

     class MyView(object):
         def __init__(self, context, request):
             self.context = context
             self.request = request

         def __call__(self):
             return Response('hello from %s!' % self.context)

    See the "Views" chapter in the documentation and the
    ``repoze.bfg.view`` API documentation for more information.

- Removed the pickling of ZCML actions (the code that wrote
   ``configure.zcml.cache`` next to ``configure.zcml`` files in
   projects).  The code which managed writing and reading of the cache
   file was a source of subtle bugs when users switched between
   imperative (e.g. `...@bfg_view``) registrations and declarative
   registrations (e.g. the ``view`` directive in ZCML) on the same
   project. On a moderately-sized project (535 ZCML actions and 15 ZCML
   files), executing actions read from the pickle was saving us only
   about 200ms (2.5 sec vs 2.7 sec average). On very small projects (1
   ZCML file and 4 actions), startup time was comparable, and sometimes
   even slower when reading from the pickle, and both ways were so fast
   that it really just didn't matter anyway.
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to