Hi Chris,

Am 05.12.2011, 04:02 Uhr, schrieb Chris McDonough <chr...@plope.com>:

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.

eek! I'm sure there was a better reason for this in the first place. As things stand ZCML declarations are not orthogonal so a key-based approach seems the better fit.

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
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.

+1 as all ZTK test pass.

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.

I'm trying to think of where I've seen that pattern of {'organised'.... 'others':{}} before... oh, yes in dodgy RDBMS schema.

Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope )

Reply via email to