On Jan 16, 8:23 am, Andrey Popp <8may...@gmail.com> wrote: > Hello, > > I've just noticed[1] the adding of 'add_directive' method to 'Configurator' > which is allow to extend it with configuration methods. But I have some > questions: > > 1. Isn't this way is not very documentable? I mean, how would framework > extenders document methods, they've added to 'Configurator'? For example, > another solution to this problem is to compose application configurator from > pyramid.config.Configurator mixed with some other extension classes (Mix-in > pattern) -- this way extension methods are documented in their respectable > mix-ins in usual way. See how I've done in in contentlet[2].
We've documented it in a number of places now. I don't know how successfully though: http://docs.pylonsproject.org/projects/pyramid_handlers/dev/#setup http://docs.pylonsproject.org/projects/pyramid_zcml/dev/#setup But inheritance kinda sucks in general for extensibility, IMO. > 2. I'm afraid this way does not respect ZCML mechanism of configuration, > so developers should bother both of adding methods to configurator and also > of adding corresponding ZCML directives. How about using some kind of > reflection to generate ZCML directives for new methods -- this way we can > keep both configuration API in sync? We're actually in a way better place for that than we used to be. Basically all ZCML directives in the pyramid_zcml package (except ones copied from Zope like utility) are plain method calls to a single configurator method. They used to be many, many lines long. With a call to config.include('somepackage'), a subsequent load_zcml can make use of a "prechewed" configurator method that can be used imperatively. That used to not be the case and the imperative code and the ZCML handler code were basically copies of one another. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.