[Zope-dev] zope.app.publisher refactoring status

Dan Korostelev nadako at gmail.com
Mon Aug 24 21:07:05 EDT 2009


Hi people.

As you might notice, I was refactoring zope.app.publisher in my
sandbox. The work is mostly done now, apart from couple of things
still in question.

Four new packages have been introduced:

 * zope.browsermenu - browser menu system, without any changes. :-)

 * zope.browserpage - browser:page directive and friends. the
directives was changed to support menu item registration only when
zope.browsermenu is available, simply ignoring (and raising a warning)
the "menu" argument otherwise.

 * zope.browserresource - resource system and browser:resource
directive and friends. file-based resources now supports pluggable
resource class lookup based on file extension (implementation based on
this patch - https://bugs.launchpad.net/zope3/+bug/98459). this allows
to separate pagetemplate resources into another package as well as
support registering specific resource factories for some extensions
(.zrt for example).

 * zope.ptresource - the page template resource that was moved into a
separate package to make zope.browserresource independent from
zope.pagetemplate. it's now a plugin for zope.browserresource - a
custom resource factory, registered for "pt", "zpt" and "html"
extensions.

The ModifiableBrowserLanguages adapter was moved into
zope.publisher.browser, as well as some ZCML security declarations
defined for zope.publisher's classes.

Things left in zope.app.publisher are still to be discussed.

First, the "Browser Skins" vocabulary - a vocabulary of
IBrowserSkinType utilities. It could be moved to zope.publisher, but
it introduces dependency on zope.componentvocabulary, which is not
needed for zope.publisher currently. So there's three options to
choose from:

 a) Move it to zope.publisher, introducing a dependency on
zope.componentvocabulary for it.
 b) Move it to zope.publisher, rewriting the vocabulary to use
zope.schema's SimpleVocabulary and not introducing dependency on
zope.componentvocabulary.
 c) Leave it there as is. I think, that it's a nice option, since
"Browser Skins" vocabulary doesn't seem to be used anywhere by other
zope packages and can be easily recreated if someone will need it.

Second, the "browser:defaultView" and "browser:defaultSkin"
directives. The functionality of default views and default skins is
currently contained in zope.publisher, and these directives only
provide a way to configure default view/skin via ZCML. I think that
these directives should be moved to zope.publisher as well, since it
seems the right place for them and the move won't introduce extra
dependencies for zope.publisher.

Third, the "xmlrpc:view" directive and the XML-RPC method publisher.
It's a nice thing, but people doesn't seem to be interested very much
in XML-RPC these days. Also, it seems that zope.publisher will be
refactored soon, so the future of xmlrpc modules is not clear. I see
two options for this thing:

 a) Extract it into the new, "zope.xmlrpc" module.
 b) Leave it there as is.

If noone demonstrates interest in discussing the xmlrpc, I'll probably
choose option b :-)

The code is available in
svn://svn.zope.org/repos/main/Sandbox/nadako/zope.app.publisher/. It
will also check out newly created packages via svn:externals, so all
you need for testing is simply checkout zope.app.publisher from my
sandbox.

--
WBR, Dan Korostelev


More information about the Zope-Dev mailing list