Hash: SHA1

Stephan Richter wrote:


>>>  The second approach is to reduce the ZCML processing time, which could
>>>be integrated into the reload mechanism for Zope 2. This can be
>>>accomplished by storing some binary representation of the ZCML, similarly
>>>to ``*.pyc`` files in Python. Again there are several choices to consider
>>>and they should probably all be tried. The first solution would be to
>>>store a pickle of each parsed directive, namely the action and its
>>>arguments. There would be one pickle file fore each ZCML file. When the
>>>ZCML file changed, the pickle would be updated. Pickle loading would be
>>>much faster than pure ZCML loading, since no XML-parsing, value
>>>conversion and schema validation would be necessary.
>>Note that this will require a refactoring of ZCML handlers to define
>>picklable actions.  This will also require refactoring so that work now
>>done by handlers be defered to action execution.
> As I explained to Jim on IRC, I am not proposing pickling the configuration 
> actions, but the configuration handler callable and its arguments. For 
> functions, this is trivial to do. For complex directives that use classes 
> this is a little bit harder, but not much.
> We will still have the benefit of saving value conversion and validation, as 
> well as XML parsing (though I am not sure whether pickle parsing is faster). 
> The approach is also much safer, since it does not depend on the subtleties 
> of directives, which is good. Not only are actions often unpickable, but some 
> directives also do not generate actions, but do their work directly; this is 
> due to some bootstrap issues. An approach pickling actions would miss
> those registrations. The more I think about this, the more I believe
> this is the right approach.

- -1.  This fact is a wart on the current system:  it means that it is
currently impossible to *parse* the ZCML file without allowing any
directive make arbitrary changes to the interpreter state.  Directives
should *never* do more than register actions.

We can remove all these issues that I know of if we make the dotted-name
checker less "eager":  rather than performing the check inline, during
parsing, it should record the name, plus file and line number, for
checking only after the actions have been run.

At that point, all actions should be trivially picklable, and we get the
bonus of being able to introspect the ZCML without actually executing it.

- --
Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to