diff -aur --exclude=.svn Zope/lib/python/zope/viewlet/metaconfigure.py DevZope2/lib/python/zope/viewlet/metaconfigure.py --- Zope/lib/python/zope/viewlet/metaconfigure.py 2007-05-25 16:53:57.000000000 +0000 +++ DevZope2/lib/python/zope/viewlet/metaconfigure.py 2007-05-25 16:34:20.000000000 +0000 @@ -187,3 +187,13 @@ args = ('registerAdapter', new_class, (for_, layer, view, manager), interfaces.IViewlet, name, _context.info),) + +def ResourceViewletDirective(_context, name, permission, + for_=Interface, layer=IDefaultBrowserLayer, view=IBrowserView, + manager=interfaces.IResourceViewletManager, class_=None, template=None, + attribute='render', allowed_interface=None, allowed_attributes=None, + **kwargs): + """There is no need for a method body because it merely calls on the parent + classes for all needed functionality. + Author: Aaron Cripps, MUN Housing. cripps@cs.mun.ca""" + pass + Only in DevZope2/lib/python/zope/viewlet: metaconfigure.py~ diff -aur --exclude=.svn Zope/lib/python/zope/viewlet/metadirectives.py DevZope2/lib/python/zope/viewlet/metadirectives.py --- Zope/lib/python/zope/viewlet/metadirectives.py 2007-05-25 16:53:57.000000000 +0000 +++ DevZope2/lib/python/zope/viewlet/metadirectives.py 2007-05-25 16:34:21.000000000 +0000 @@ -21,6 +21,7 @@ import zope.schema from zope.publisher.interfaces import browser from zope.i18nmessageid import MessageFactory +from zope.app.publisher.browser import IResourceDirective _ = MessageFactory('zope') from zope.app.publisher.browser import metadirectives @@ -102,6 +103,20 @@ required=False, default=interfaces.IViewletManager) +class IResourceViewletDirective(IViewletDirective,IResourceDirective): + """A directive to register a new viewlet and it's resource. + + By registering both a viewlet *and* it's directive we save typing, and + complexity, by redicing the calls to the viewlet directive in the + configuration of a viewlet. This reduces the calls by half. + Author: Aaron Cripps, MUN Housing. cripps@cs.mun.ca + """ + + manager = zope.configuration.fields.GlobalObject( + title=_("view"), + description=u"The interface of the view this viewlet is for. " + u"(default IBrowserView)""", + required=False, + default=interfaces.IViewletManager) # Arbitrary keys and values are allowed to be passed to the viewlet. IViewletDirective.setTaggedValue('keyword_arguments', True) Only in DevZope2/lib/python/zope/viewlet: metadirectives.py~ diff -aur --exclude=.svn Zope/lib/python/zope/viewlet/meta.zcml DevZope2/lib/python/zope/viewlet/meta.zcml --- Zope/lib/python/zope/viewlet/meta.zcml 2007-05-25 16:53:57.000000000 +0000 +++ DevZope2/lib/python/zope/viewlet/meta.zcml 2007-05-25 16:34:26.000000000 +0000 @@ -15,6 +15,12 @@ handler=".metaconfigure.viewletManagerDirective" /> + + Only in DevZope2/lib/python/zope/viewlet: meta.zcml~