Author: jmorliaguet Date: Fri Jun 9 22:57:02 2006 New Revision: 3382 Added: cpsskins/branches/paris-sprint-2006/configuration/portlets/factory.py (contents, props changed) Modified: cpsskins/branches/paris-sprint-2006/configuration/portlets/metaconfigure.py
Log: - register a "real" portlet factory with the provider information, etc. Added: cpsskins/branches/paris-sprint-2006/configuration/portlets/factory.py ============================================================================== --- (empty file) +++ cpsskins/branches/paris-sprint-2006/configuration/portlets/factory.py Fri Jun 9 22:57:02 2006 @@ -0,0 +1,40 @@ +############################################################################## +# +# Copyright (c) 2005-2006 Nuxeo and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" + +$Id$ +""" +__docformat__ = "reStructuredText" + +from zope.component.interfaces import IFactory +from zope.component.factory import Factory +from zope.interface import implements, implementedBy + +class IPortletFactory(IFactory): + """Portlet factory interface""" + +class PortletFactory(Factory): + """A portlet factory. + """ + implements(IPortletFactory) + + def __init__(self, callable, provider=u'', title='', description=''): + self._callable = callable + self.provider = provider + self.title = title + self.description = description + + def getInterfaces(self): + return implementedBy(self._callable) + Modified: cpsskins/branches/paris-sprint-2006/configuration/portlets/metaconfigure.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/configuration/portlets/metaconfigure.py (original) +++ cpsskins/branches/paris-sprint-2006/configuration/portlets/metaconfigure.py Fri Jun 9 22:57:02 2006 @@ -27,13 +27,14 @@ from zope.app.content.interfaces import IContentType from zope.component.factory import Factory from zope.component.interface import provideInterface -from zope.component.interfaces import IFactory from zope.component.zcml import utility from zope.configuration.exceptions import ConfigurationError from zope.interface import Interface, alsoProvides from cpsskins import ui from cpsskins.browser.rendering.interfaces import IUpdateData +from cpsskins.configuration.portlets.factory import PortletFactory +from cpsskins.configuration.portlets.factory import IPortletFactory from cpsskins.setup.interfaces import INameType ui_path = os.path.dirname(ui.__file__) @@ -82,11 +83,12 @@ c.require(_context=_context, permission="zope.ManageContent", set_schema=(schema, IUpdateData)) - factory=Factory(class_) # register the portlet factory - utility(_context=_context, provides=IFactory, component=factory, + factory = PortletFactory(callable=class_, provider=provider, title=title, + description=description) + utility(_context=_context, provides=IPortletFactory, component=factory, name=u'cpsskins.portlet.%s' % dotted_name) - utility(_context=_context, provides=IFactory, component=factory, + utility(_context=_context, provides=IPortletFactory, component=factory, name=u'cpsskins.canvas.%s' % dotted_name) # set up interface types -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins