[Zope-dev] merge zope.configuration dictactions branch

Chris McDonough chrism at plope.com
Mon Dec 5 03:02:59 UTC 2011


ssh://svn.zope.org/repos/main/zope.configuration/branches/chrism-dictactions

Rationale:

I want to be able to associate a new value ("introspectables") with each
ZCML configuration action, in support of ZCML support for Pyramid
features described at:

http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/introspector.html  http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/extconfig.html#configuration-introspection

A rough example UI for the feature is shown here:

http://static.repoze.org/introspection/

On the zope.configuration trunk (and in all past releases), each ZCML
action is maintained as a tuple.  The tuple can be of any length up to
seven elements, but mustn't exceed a length of seven.  A complex system
of lengthening and shortening (in
zope.configuration.config.resolveConflicts) tries to ensure that the
tuple is of the smallest length required by chopping false elements off
the end of each action tuple during storage and reconstituting them to
7-element tuples during processing and sorting.  I think this juke was
purely to make doctests easier to write, but I'm not entirely sure.

Up til now, pyramid_zcml could live with actions being at most 7
elements.  But recent changes to the Pyramid trunk (adding
"introspectables") blew out the presumption that an action tuple could
be no longer than 7 elements (it now might need to be 8 elements).

Rather than extend the structure of the zope.configuration tuple with a
Pyramid-only "introspectables" argument, I've created the
chrism-dictactions branch
(http://svn.zope.org/zope.configuration/branches/chrism-dictactions/)
which changes ZCML action structures to be dictionaries.  This allows
each action to contain arbitrary keys.  This modification satisfies the
immediate requirement (adding "introspectables") and allows us to never
need to change the zope.config code again if more elements need to be
added to actions.

I could have instead added an "extras" dictionary on to the end of the
tuple as an 8th element, but it seems six of one a half dozen of
another, and the z.config code is much easier to understand when the
action is just a dictionary instead of a pseudo-struct.

All ZTK tests pass with the chrism-dictactions branch, and any code that
depended upon the action structures was likely overstepping its bounds
anyway.  I'd like to merge this branch to the zope.configuration trunk
as a result, and create a new release.

The (unlikely) alternatives are: drop support for ZCML in Pyramid, drop
plans to support introspectables in Pyramid.



More information about the Zope-Dev mailing list