[Checkins] SVN: GenericSetup/trunk/ - added 'components_xmlconfig.html' form

Yvo Schubbe y.2007- at wcm-solutions.de
Thu Jul 26 12:59:13 EDT 2007


Log message for revision 78358:
  - added 'components_xmlconfig.html' form

Changed:
  A   GenericSetup/trunk/browser/components.py
  A   GenericSetup/trunk/browser/configure.zcml
  U   GenericSetup/trunk/configure.zcml
  U   GenericSetup/trunk/context.py

-=-
Copied: GenericSetup/trunk/browser/components.py (from rev 78357, GenericSetup/branches/1.3/browser/components.py)
===================================================================
--- GenericSetup/trunk/browser/components.py	                        (rev 0)
+++ GenericSetup/trunk/browser/components.py	2007-07-26 16:59:12 UTC (rev 78358)
@@ -0,0 +1,71 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation 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.
+#
+##############################################################################
+"""Components setup view.
+
+$Id$
+"""
+
+from Products.Five.component.interfaces import IObjectManagerSite
+from Products.Five.formlib.formbase import PageEditForm
+from zope.component import adapts
+from zope.component import getMultiAdapter
+from zope.formlib import form
+from zope.interface import implements
+from zope.interface import Interface
+from zope.schema import Text
+
+from Products.GenericSetup.context import SetupEnviron
+from Products.GenericSetup.interfaces import IBody
+
+
+class IComponentsSetupSchema(Interface):
+
+    """Schema for components setup views.
+    """
+
+    body = Text(
+        title=u'Settings')
+
+
+class ComponentsSetupSchemaAdapter(object):
+
+    adapts(IObjectManagerSite)
+    implements(IComponentsSetupSchema)
+
+    def __init__(self, context):
+        self.context = context
+
+    def _getBody(self):
+        sm = self.context.aq_inner.getSiteManager()
+        return getMultiAdapter((sm, SetupEnviron()), IBody).body
+
+    def _setBody(self, value):
+        sm = self.context.aq_inner.getSiteManager()
+        getMultiAdapter((sm, SetupEnviron()), IBody).body = value
+
+    body = property(_getBody, _setBody)
+
+
+class ComponentsSetupView(PageEditForm):
+
+    """Components setup view for IObjectManagerSite.
+    """
+
+    label = u'Component Registry: XML Configuration'
+
+    form_fields = form.FormFields(IComponentsSetupSchema)
+
+    def setUpWidgets(self, ignore_request=False):
+        super(ComponentsSetupView,
+              self).setUpWidgets(ignore_request=ignore_request)
+        self.widgets['body'].height = 24


Property changes on: GenericSetup/trunk/browser/components.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Copied: GenericSetup/trunk/browser/configure.zcml (from rev 78357, GenericSetup/branches/1.3/browser/configure.zcml)
===================================================================
--- GenericSetup/trunk/browser/configure.zcml	                        (rev 0)
+++ GenericSetup/trunk/browser/configure.zcml	2007-07-26 16:59:12 UTC (rev 78358)
@@ -0,0 +1,14 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser">
+
+  <adapter factory=".components.ComponentsSetupSchemaAdapter"/>
+
+  <browser:page
+      for="Products.Five.component.interfaces.IObjectManagerSite"
+      name="components_xmlconfig.html"
+      class=".components.ComponentsSetupView"
+      permission="five.ManageSite"
+      />
+
+</configure>


Property changes on: GenericSetup/trunk/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: GenericSetup/trunk/configure.zcml
===================================================================
--- GenericSetup/trunk/configure.zcml	2007-07-26 16:54:37 UTC (rev 78357)
+++ GenericSetup/trunk/configure.zcml	2007-07-26 16:59:12 UTC (rev 78358)
@@ -2,6 +2,8 @@
     xmlns="http://namespaces.zope.org/zope"
     >
 
+  <include package=".browser"/>
+
   <include package=".MailHost"/>
 
   <include package=".OFSP"/>

Modified: GenericSetup/trunk/context.py
===================================================================
--- GenericSetup/trunk/context.py	2007-07-26 16:54:37 UTC (rev 78357)
+++ GenericSetup/trunk/context.py	2007-07-26 16:59:12 UTC (rev 78358)
@@ -41,6 +41,7 @@
 
 from interfaces import IExportContext
 from interfaces import IImportContext
+from interfaces import ISetupEnviron
 from interfaces import IWriteLogger
 from interfaces import SKIPPED_FILES
 from interfaces import SKIPPED_SUFFIXES
@@ -95,10 +96,35 @@
         self._logger.log(level, msg, *args, **kwargs)
 
 
-class BaseContext( Implicit ):
+class SetupEnviron(Implicit):
 
+    """Context for body im- and exporter.
+    """
+
+    implements(ISetupEnviron)
+
     security = ClassSecurityInfo()
 
+    def __init__(self):
+        self._should_purge = True
+
+    security.declareProtected(ManagePortal, 'getLogger')
+    def getLogger(self, name):
+        """Get a logger with the specified name, creating it if necessary.
+        """
+        return logging.getLogger('GenericSetup.%s' % name)
+
+    security.declareProtected(ManagePortal, 'shouldPurge')
+    def shouldPurge(self):
+        """When installing, should the existing setup be purged?
+        """
+        return self._should_purge
+
+
+class BaseContext(SetupEnviron):
+
+    security = ClassSecurityInfo()
+
     def __init__( self, tool, encoding ):
 
         self._tool = tool
@@ -149,14 +175,7 @@
         """
         self._messages[:] = []
 
-    security.declareProtected( ManagePortal, 'shouldPurge' )
-    def shouldPurge( self ):
 
-        """ See ISetupContext.
-        """
-        return self._should_purge
-
-
 class DirectoryImportContext( BaseContext ):
 
     implements(IImportContext)



More information about the Checkins mailing list