[Checkins] SVN: Products.GenericSetup/trunk/Products/GenericSetup/ Wrap long lines.

Tres Seaver tseaver at palladion.com
Tue Feb 28 23:40:00 UTC 2012


Log message for revision 124483:
  Wrap long lines.

Changed:
  U   Products.GenericSetup/trunk/Products/GenericSetup/components.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/registry.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_components.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_events.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_stepzcml.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_tool.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_utils.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tests/test_zcml.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/tool.py
  U   Products.GenericSetup/trunk/Products/GenericSetup/zcml.py

-=-
Modified: Products.GenericSetup/trunk/Products/GenericSetup/components.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/components.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/components.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -294,7 +294,8 @@
                     ofs_id = self._ofs_id(child)
                     if ofs_id in self.context.objectIds():
                         self.context._delObject(ofs_id, suppress_events=True)
-                    self.context.unregisterUtility(provided=provided, name=name)
+                    self.context.unregisterUtility(provided=provided,
+                                                   name=name)
                 continue
 
             if component and factory:
@@ -394,8 +395,8 @@
 
         registrations = [ {'factory': _getDottedName(reg.factory),
                            'provided': _getDottedName(reg.provided),
-                           'required': reg.required}
-                          for reg in self.context.registeredSubscriptionAdapters() ]
+                           'required': reg.required} for reg
+                            in self.context.registeredSubscriptionAdapters() ]
         registrations.sort(key=itemgetter('factory'))
         registrations.sort(key=itemgetter('provided'))
         blacklist = self._constructBlacklist()
@@ -470,8 +471,8 @@
             else:
                 factory = None
                 comp = reg_info['component']
-                # check if the component is acquisition wrapped. If it is, export
-                # an object reference instead of a factory reference
+                # check if the component is acquisition wrapped. If it is,
+                # export an object reference instead of a factory reference
                 if getattr(comp, 'aq_base', None) is not None:
                     if aq_base(comp) is site:
                         child.setAttribute('object', '')

Modified: Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/interfaces.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -544,7 +544,8 @@
             step
         """
 
-    def runAllImportStepsFromProfile(profile_id, purge_old=None, ignore_dependencies=False):
+    def runAllImportStepsFromProfile(profile_id, purge_old=None,
+                                     ignore_dependencies=False):
 
         """ Run all setup steps for the given profile in dependency order.
 
@@ -813,7 +814,8 @@
 class IBeforeProfileImportEvent(Interface):
     """ An event which is fired before (part of) a profile is imported.
     """
-    profile_id = Attribute("id of the profile to be imported or None for non-profile imports.")
+    profile_id = Attribute("id of the profile to be imported "
+                           "or None for non-profile imports.")
 
     steps = Attribute("list of steps that will be imported")
 

Modified: Products.GenericSetup/trunk/Products/GenericSetup/registry.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/registry.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -239,7 +239,8 @@
 
     def values(self):
         sm = getGlobalSiteManager()
-        values = [info for name, info in sm.getUtilitiesFor(self.interfaceClass)]
+        values = [info for name, info
+                        in sm.getUtilitiesFor(self.interfaceClass)]
         return values
 
     def get(self, key):

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_components.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_components.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_components.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -81,13 +81,13 @@
     def verify(self):
         return True
 
-class IAnotherDummyInterface(Interface):
+class IAnotherDummy(Interface):
     """A third dummy interface."""
 
     def inc():
         """Increments handle count"""
 
-class IAnotherDummyInterface2(Interface):
+class IAnotherDummy2(Interface):
     """A second dummy interface."""
 
     def verify():
@@ -96,7 +96,7 @@
 class DummyObject(object):
     """A dummy object to pass to the handler."""
 
-    implements(IAnotherDummyInterface)
+    implements(IAnotherDummy)
 
     handled = 0
 
@@ -106,7 +106,7 @@
 class DummyAdapter(object):
     """A dummy adapter."""
 
-    implements(IAnotherDummyInterface2)
+    implements(IAnotherDummy2)
 
     def __init__(self, context):
         pass
@@ -164,19 +164,18 @@
  <adapters>
   <adapter factory="Products.GenericSetup.tests.test_components.DummyAdapter"
      for="zope.interface.Interface"
-     provides="Products.GenericSetup.tests.test_components.IAnotherDummyInterface2"/>
+     provides="Products.GenericSetup.tests.test_components.IAnotherDummy2"/>
   <adapter name="foo"
      factory="Products.GenericSetup.tests.test_components.DummyAdapter"
      for="zope.interface.Interface"
-     provides="Products.GenericSetup.tests.test_components.IAnotherDummyInterface2"/>
+     provides="Products.GenericSetup.tests.test_components.IAnotherDummy2"/>
  </adapters>
  <subscribers>
   <subscriber
      factory="Products.GenericSetup.tests.test_components.DummyAdapter"
-     for="Products.GenericSetup.tests.test_components.IAnotherDummyInterface"
-     provides="Products.GenericSetup.tests.test_components.IAnotherDummyInterface2"/>
-  <subscriber
-     for="Products.GenericSetup.tests.test_components.IAnotherDummyInterface"
+     for="Products.GenericSetup.tests.test_components.IAnotherDummy"
+     provides="Products.GenericSetup.tests.test_components.IAnotherDummy2"/>
+  <subscriber for="Products.GenericSetup.tests.test_components.IAnotherDummy"
      handler="Products.GenericSetup.tests.test_components.dummy_handler"/>
  </subscribers>
  <utilities>
@@ -201,17 +200,17 @@
 <componentregistry>
  <adapters>
   <adapter factory="Products.GenericSetup.tests.test_components.DummyAdapter"
-     provides="Products.GenericSetup.tests.test_components.IAnotherDummyInterface2"
+     provides="Products.GenericSetup.tests.test_components.IAnotherDummy2"
      for="*" remove="True"/>
  </adapters>
  <subscribers>
   <subscriber
      factory="Products.GenericSetup.tests.test_components.DummyAdapter"
-     for="Products.GenericSetup.tests.test_components.IAnotherDummyInterface"
-     provides="Products.GenericSetup.tests.test_components.IAnotherDummyInterface2"
+     for="Products.GenericSetup.tests.test_components.IAnotherDummy"
+     provides="Products.GenericSetup.tests.test_components.IAnotherDummy2"
      remove="True"/>
   <subscriber
-     for="Products.GenericSetup.tests.test_components.IAnotherDummyInterface"
+     for="Products.GenericSetup.tests.test_components.IAnotherDummy"
      handler="Products.GenericSetup.tests.test_components.dummy_handler"
      remove="True"/>
  </subscribers>
@@ -245,8 +244,9 @@
         obj.registerAdapter(DummyAdapter, required=(None,))
         obj.registerAdapter(DummyAdapter, required=(None,), name=u'foo')
 
-        obj.registerSubscriptionAdapter(DummyAdapter, required=(IAnotherDummyInterface,))
-        obj.registerHandler(dummy_handler, required=(IAnotherDummyInterface,))
+        obj.registerSubscriptionAdapter(DummyAdapter,
+                                        required=(IAnotherDummy,))
+        obj.registerHandler(dummy_handler, required=(IAnotherDummy,))
 
         util = DummyUtility()
         name = 'dummy_utility'
@@ -257,7 +257,8 @@
         obj.registerUtility(aq_base(obj[name]), IDummyInterface)
 
         util = DummyUtility()
-        name = 'Products.GenericSetup.tests.test_components.IDummyInterface2-foo'
+        name = ('Products.GenericSetup.tests.test_components.'
+                    'IDummyInterface2-foo')
         util.__name__ = name
         util.__parent__ = aq_base(obj)
         obj._setObject(name, aq_base(util),
@@ -271,16 +272,17 @@
         obj.registerUtility(tool2, IDummyInterface2, name=u'dummy tool name2')
 
     def _verifyImport(self, obj):
-        adapted = queryAdapter(object(), IAnotherDummyInterface2)
-        self.failUnless(IAnotherDummyInterface2.providedBy(adapted))
+        adapted = queryAdapter(object(), IAnotherDummy2)
+        self.failUnless(IAnotherDummy2.providedBy(adapted))
         self.failUnless(adapted.verify())
 
-        adapted = queryAdapter(object(), IAnotherDummyInterface2, name=u'foo')
-        self.failUnless(IAnotherDummyInterface2.providedBy(adapted))
+        adapted = queryAdapter(object(), IAnotherDummy2, name=u'foo')
+        self.failUnless(IAnotherDummy2.providedBy(adapted))
         self.failUnless(adapted.verify())
 
         dummy = DummyObject()
-        results = [adap.verify() for adap in subscribers([dummy], IAnotherDummyInterface2)]
+        results = [adap.verify() for adap in
+                        subscribers([dummy], IAnotherDummy2)]
         self.assertEquals(results, [True])
 
         dummy = DummyObject()
@@ -291,7 +293,8 @@
         self.failUnless(IDummyInterface.providedBy(util))
         self.failUnless(util.verify())
         self.failUnless(util.__parent__ == obj)
-        name = 'Products.GenericSetup.tests.test_components.IDummyInterface2-foo'
+        name = ('Products.GenericSetup.tests.test_components.'
+                    'IDummyInterface2-foo')
         self.assertEquals(util.__name__, name)
         self.failUnless(name in obj.objectIds())
 
@@ -390,15 +393,16 @@
         context._files['componentregistry.xml'] = _REMOVE_IMPORT
         importComponentRegistry(context)
 
-        adapted = queryAdapter(object(), IAnotherDummyInterface2)
+        adapted = queryAdapter(object(), IAnotherDummy2)
         self.failUnless(adapted is None)
 
         # This one should still exist
-        adapted = queryAdapter(object(), IAnotherDummyInterface2, name=u'foo')
+        adapted = queryAdapter(object(), IAnotherDummy2, name=u'foo')
         self.failIf(adapted is None)
 
         dummy = DummyObject()
-        results = [adap.verify() for adap in subscribers([dummy], IAnotherDummyInterface2)]
+        results = [adap.verify() for adap in
+                        subscribers([dummy], IAnotherDummy2)]
         self.assertEquals(results, [])
 
         dummy = DummyObject()
@@ -406,7 +410,8 @@
         self.assertEquals(dummy.handled, 0)
 
         util = queryUtility(IDummyInterface2, name=u'foo')
-        name = 'Products.GenericSetup.tests.test_components.IDummyInterface2-foo'
+        name = ('Products.GenericSetup.tests.test_components.'
+                    'IDummyInterface2-foo')
         self.failUnless(util is None)
         self.failIf(name in obj.objectIds())
 

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_events.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_events.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_events.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -18,7 +18,8 @@
         self.assertEqual(event.full_import, "full_import")
 
     def testKeywordConstruction(self):
-        event=self.klass(tool="tool", profile_id="profile_id", steps="steps", full_import="full_import")
+        event = self.klass(tool="tool", profile_id="profile_id", steps="steps",
+                           full_import="full_import")
         self.assertEqual(event.tool, "tool")
         self.assertEqual(event.profile_id, "profile_id")
         self.assertEqual(event.steps, "steps")

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_stepzcml.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_stepzcml.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_stepzcml.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -26,10 +26,13 @@
     from Products.Five import zcml
 
 
-EMPTY_ZCML = '''<configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
+EMPTY_ZCML = '''\
+<configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
 </configure>'''
 
-ONE_STEP_ZCML = '''<configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup" i18n_domain="genericsetup">
+ONE_STEP_ZCML = '''\
+<configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+           i18n_domain="genericsetup">
 <genericsetup:importStep
     name="Products.GenericSetup.teststep"
     title="step title"

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_tool.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_tool.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_tool.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -46,7 +46,7 @@
 from Products.GenericSetup.tests.test_registry import IDerivedSite
 from Products.GenericSetup.tests.test_registry import ISite
 from Products.GenericSetup.tests.test_registry import ONE_FUNC
-from Products.GenericSetup.tests.test_zcml import dummy_upgrade_handler
+from Products.GenericSetup.tests.test_zcml import dummy_upgrade
 from Products.GenericSetup.upgrade import _registerUpgradeStep
 from Products.GenericSetup.upgrade import listUpgradeSteps
 from Products.GenericSetup.upgrade import UpgradeStep
@@ -953,7 +953,7 @@
         orig_upgrade_registry = copy.copy(_upgrade_registry._registry)
         step = UpgradeStep("Upgrade",
                            "GenericSetup:dummy_profile", '*', '1.1', '',
-                           dummy_upgrade_handler,
+                           dummy_upgrade,
                            None, "1")
         _registerUpgradeStep(step)
 

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_utils.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_utils.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_utils.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -683,7 +683,8 @@
         from Products.GenericSetup.utils import PrettyDocument
         original = 'baz &nbsp;<bar>&"\''
         expected = ('<?xml version="1.0"?>\n'
-                    '<doc bar="" foo="baz &amp;nbsp;&lt;bar&gt;&amp;&quot;\'"/>\n')
+                    '<doc bar="" foo="baz '
+                        '&amp;nbsp;&lt;bar&gt;&amp;&quot;\'"/>\n')
 
         doc = PrettyDocument()
         node = doc.createElement('doc')

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tests/test_zcml.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tests/test_zcml.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tests/test_zcml.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -28,19 +28,19 @@
     from Products.Five import zcml
 
 
-def dummy_importstep_handler(context):
+def dummy_importstep(context):
     pass
 
-def dummy_exportstep_handler(context):
+def dummy_exportstep(context):
     pass
 
-def dummy_upgrade_handler(context):
+def dummy_upgrade(context):
     pass
 
-def b_dummy_upgrade_handler(context):
+def b_dummy_upgrade(context):
     pass
 
-def c_dummy_upgrade_handler(context):
+def c_dummy_upgrade(context):
     pass
 
 def test_simpleRegisterProfile():
@@ -146,7 +146,7 @@
       ...       description="Upgrades Foo from 1.0 to 1.1."
       ...       source="1.0"
       ...       destination="1.1"
-      ...       handler="Products.GenericSetup.tests.test_zcml.dummy_upgrade_handler"
+      ...       handler="Products.GenericSetup.tests.test_zcml.dummy_upgrade"
       ...       sortkey="1"
       ...       profile="default"
       ...       />
@@ -156,8 +156,8 @@
 
     Make sure the upgrade step is registered correctly::
 
-      >>> from Products.GenericSetup.upgrade import _upgrade_registry
-      >>> profile_steps = _upgrade_registry.getUpgradeStepsForProfile('default')
+      >>> from Products.GenericSetup.upgrade import _upgrade_registry as _ur
+      >>> profile_steps = _ur.getUpgradeStepsForProfile('default')
       >>> keys = profile_steps.keys()
       >>> len(keys)
       1
@@ -167,7 +167,7 @@
       >>> step.dest
       ('1', '1')
       >>> step.handler
-      <function dummy_upgrade_handler at ...>
+      <function dummy_upgrade at ...>
 
     Clean up and make sure the cleanup works::
 
@@ -197,8 +197,8 @@
 
     Make sure the upgrade step is registered correctly::
 
-      >>> from Products.GenericSetup.upgrade import _upgrade_registry
-      >>> profile_steps = _upgrade_registry.getUpgradeStepsForProfile('default')
+      >>> from Products.GenericSetup.upgrade import _upgrade_registry as _ur
+      >>> profile_steps = _ur.getUpgradeStepsForProfile('default')
       >>> keys = profile_steps.keys()
       >>> len(keys)
       1
@@ -229,55 +229,54 @@
       ... <configure
       ...     xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
       ...     i18n_domain="foo">
-      ...   <genericsetup:upgradeSteps
+      ...  <genericsetup:upgradeSteps
       ...       profile="default"
       ...       source="1.0"
       ...       destination="1.1"
       ...       sortkey="2"
       ...       >
-      ...       <genericsetup:upgradeStep
-      ...           title="Foo Upgrade Step 1"
-      ...           description="Does some Foo upgrade thing."
-      ...           handler="Products.GenericSetup.tests.test_zcml.b_dummy_upgrade_handler"
-      ...           />
-      ...       <genericsetup:upgradeStep
-      ...           title="Foo Upgrade Step 2"
-      ...           description="Does another Foo upgrade thing."
-      ...           handler="Products.GenericSetup.tests.test_zcml.c_dummy_upgrade_handler"
-      ...           />
-      ...   </genericsetup:upgradeSteps>
-      ...   <genericsetup:upgradeSteps
+      ...   <genericsetup:upgradeStep
+      ...       title="Foo Upgrade Step 1"
+      ...       description="Does some Foo upgrade thing."
+      ...       handler="Products.GenericSetup.tests.test_zcml.b_dummy_upgrade"
+      ...       />
+      ...   <genericsetup:upgradeStep
+      ...       title="Foo Upgrade Step 2"
+      ...       description="Does another Foo upgrade thing."
+      ...       handler="Products.GenericSetup.tests.test_zcml.c_dummy_upgrade"
+      ...       />
+      ...  </genericsetup:upgradeSteps>
+      ...  <genericsetup:upgradeSteps
       ...       profile="default"
       ...       source="1.0"
       ...       destination="1.1"
       ...       sortkey="1"
       ...       >
-      ...       <genericsetup:upgradeStep
-      ...           title="Bar Upgrade Step 1"
-      ...           description="Does some Bar upgrade thing."
-      ...           handler="Products.GenericSetup.tests.test_zcml.b_dummy_upgrade_handler"
-      ...           />
-      ...       <genericsetup:upgradeStep
-      ...           title="Bar Upgrade Step 2"
-      ...           description="Does another Bar upgrade thing."
-      ...           handler="Products.GenericSetup.tests.test_zcml.c_dummy_upgrade_handler"
-      ...           />
-      ...       <genericsetup:upgradeDepends
-      ...           title="Bar Upgrade dependency profile import steps"
-      ...           description="Re-imports steps from the profile"
-      ...           import_profile="profile-Products.CMFDefault:default"
-      ...           import_steps="baz bat"
-      ...           run_deps="True"
-      ...           purge="True"
-      ...           />
-      ...   </genericsetup:upgradeSteps>
+      ...   <genericsetup:upgradeStep
+      ...       title="Bar Upgrade Step 1"
+      ...       description="Does some Bar upgrade thing."
+      ...       handler="Products.GenericSetup.tests.test_zcml.b_dummy_upgrade"
+      ...       />
+      ...   <genericsetup:upgradeStep
+      ...       title="Bar Upgrade Step 2"
+      ...       description="Does another Bar upgrade thing."
+      ...       handler="Products.GenericSetup.tests.test_zcml.c_dummy_upgrade"
+      ...       />
+      ...   <genericsetup:upgradeDepends
+      ...       title="Bar Upgrade dependency profile import steps"
+      ...       description="Re-imports steps from the profile"
+      ...       import_profile="profile-Products.CMFDefault:default"
+      ...       import_steps="baz bat"
+      ...       run_deps="True"
+      ...       purge="True"
+      ...       />
+      ...  </genericsetup:upgradeSteps>
       ... </configure>'''
       >>> zcml.load_config('meta.zcml', Products.GenericSetup)
       >>> zcml.load_string(configure_zcml)
 
     Make sure the upgrade steps are registered correctly::
 
-      >>> from Products.GenericSetup.upgrade import _upgrade_registry
       >>> from Products.GenericSetup.upgrade import listUpgradeSteps
       >>> from Products.GenericSetup.tool import SetupTool
       >>> tool = SetupTool('setup_tool')
@@ -295,11 +294,11 @@
       >>> step1['dest'] == step2['dest'] == step3['dest'] == ('1', '1')
       True
       >>> step1['step'].handler
-      <function b_dummy_upgrade_handler at ...>
+      <function b_dummy_upgrade at ...>
       >>> step1['title']
       u'Bar Upgrade Step 1'
       >>> step2['step'].handler
-      <function c_dummy_upgrade_handler at ...>
+      <function c_dummy_upgrade at ...>
       >>> step2['title']
       u'Bar Upgrade Step 2'
       >>> step3['step'].import_profile
@@ -324,11 +323,11 @@
       >>> step1['dest'] == step2['dest'] == ('1', '1')
       True
       >>> step1['step'].handler
-      <function b_dummy_upgrade_handler at ...>
+      <function b_dummy_upgrade at ...>
       >>> step1['title']
       u'Foo Upgrade Step 1'
       >>> step2['step'].handler
-      <function c_dummy_upgrade_handler at ...>
+      <function c_dummy_upgrade at ...>
       >>> step2['title']
       u'Foo Upgrade Step 2'
 
@@ -349,20 +348,20 @@
         cleanUp()
 
     def testNoDependencies(self):
-        zcml.load_string("""<configure
-                              xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
-                              i18n_domain="genericsetup">
-                             <genericsetup:importStep
-                                 name="name"
-                                 title="title"
-                                 description="description"
-                                 handler="Products.GenericSetup.tests.test_zcml.dummy_importstep_handler">
-                             </genericsetup:importStep>
-                            </configure>""")
+        zcml.load_string("""\
+        <configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+                   i18n_domain="genericsetup">
+         <genericsetup:importStep
+             name="name"
+             title="title"
+             description="description"
+             handler="Products.GenericSetup.tests.test_zcml.dummy_importstep">
+         </genericsetup:importStep>
+        </configure>""")
         self.assertEqual( _import_step_registry.listSteps(), [u'name'])
         data=_import_step_registry.getStepMetadata(u'name')
         self.assertEqual(data["handler"],
-                'Products.GenericSetup.tests.test_zcml.dummy_importstep_handler')
+                'Products.GenericSetup.tests.test_zcml.dummy_importstep')
         self.assertEqual(data["description"], u"description")
         self.assertEqual(data["title"], u"title")
         self.assertEqual(data["dependencies"], ())
@@ -370,17 +369,17 @@
 
 
     def testWithDependency(self):
-        zcml.load_string("""<configure
-                              xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
-                              i18n_domain="genericsetup">
-                             <genericsetup:importStep
-                                 name="name"
-                                 title="title"
-                                 description="description"
-                                 handler="Products.GenericSetup.tests.test_zcml.dummy_importstep_handler">
-                                <depends name="something.else"/>
-                             </genericsetup:importStep>
-                            </configure>""")
+        zcml.load_string("""
+        <configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+                   i18n_domain="genericsetup">
+         <genericsetup:importStep
+             name="name"
+             title="title"
+             description="description"
+             handler="Products.GenericSetup.tests.test_zcml.dummy_importstep">
+          <depends name="something.else"/>
+         </genericsetup:importStep>
+        </configure>""")
         data=_import_step_registry.getStepMetadata(u'name')
         self.assertEqual(data["dependencies"], (u"something.else",))
 
@@ -396,21 +395,20 @@
         cleanUp()
 
     def testRegistration(self):
-        zcml.load_string("""<configure
-                              xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
-                              i18n_domain="genericsetup">
-                             <genericsetup:exportStep
-                                 name="name"
-                                 title="title"
-                                 description="description"
-                                 handler="Products.GenericSetup.tests.test_zcml.dummy_exportstep_handler"
-                                 />
-                              </configure>
-                              """)
+        zcml.load_string("""\
+        <configure xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+                   i18n_domain="genericsetup">
+        <genericsetup:exportStep
+            name="name"
+            title="title"
+            description="description"
+            handler="Products.GenericSetup.tests.test_zcml.dummy_exportstep"
+            />
+        </configure>""")
         self.assertEqual( _export_step_registry.listSteps(), [u'name'])
         data=_export_step_registry.getStepMetadata(u'name')
         self.assertEqual(data["handler"],
-                'Products.GenericSetup.tests.test_zcml.dummy_exportstep_handler')
+                'Products.GenericSetup.tests.test_zcml.dummy_exportstep')
         self.assertEqual(data["description"], u"description")
         self.assertEqual(data["title"], u"title")
         self.assertEqual(data["id"], u"name")

Modified: Products.GenericSetup/trunk/Products/GenericSetup/tool.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/tool.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -295,7 +295,8 @@
         steps.append (step_id)
 
         full_import=(set(steps)==set(self.getSortedImportSteps()))
-        event.notify(BeforeProfileImportEvent(self, profile_id, steps, full_import))
+        event.notify(
+            BeforeProfileImportEvent(self, profile_id, steps, full_import))
 
         for step in steps:
             message = self._doRunImportStep(step, context)
@@ -305,7 +306,8 @@
         message_list.extend( ['%s: %s' % x[1:] for x in context.listNotes()] )
         messages[step_id] = '\n'.join(message_list)
 
-        event.notify(ProfileImportedEvent(self, profile_id, steps, full_import))
+        event.notify(
+            ProfileImportedEvent(self, profile_id, steps, full_import))
 
         return { 'steps' : steps, 'messages' : messages }
 
@@ -319,10 +321,11 @@
         """
         __traceback_info__ = profile_id
 
-        result = self._runImportStepsFromContext(purge_old=purge_old,
-                                                 profile_id=profile_id,
-                                                 archive=archive,
-                                                 ignore_dependencies=ignore_dependencies)
+        result = self._runImportStepsFromContext(
+                            purge_old=purge_old,
+                            profile_id=profile_id,
+                            archive=archive,
+                            ignore_dependencies=ignore_dependencies)
         if profile_id is None:
             prefix = 'import-all-from-tar'
         else:
@@ -481,7 +484,8 @@
     manage_importSteps = PageTemplateFile('sutImportSteps', _wwwdir)
 
     security.declareProtected(ManagePortal, 'manage_importSelectedSteps')
-    def manage_importSelectedSteps(self, ids, run_dependencies, context_id=None):
+    def manage_importSelectedSteps(self, ids, run_dependencies,
+                                   context_id=None):
         """ Import the steps selected by the user.
         """
         messages = {}
@@ -889,7 +893,8 @@
             self.setLastVersionForProfile(profile_id, step.dest)
 
         url = self.absolute_url()
-        request.RESPONSE.redirect("%s/manage_upgrades?saved=%s" % (url, profile_id))
+        request.RESPONSE.redirect("%s/manage_upgrades?saved=%s"
+                                    % (url, profile_id))
 
     #
     #   Helper methods
@@ -912,13 +917,15 @@
                     path = info['path']
                 if should_purge is None:
                     should_purge = (info.get('type') != EXTENSION)
-                return DirectoryImportContext(self, path, should_purge, encoding)
+                return DirectoryImportContext(self, path, should_purge,
+                                              encoding)
 
             elif context_id.startswith('snapshot-'):
                 context_id = context_id[len('snapshot-'):]
                 if should_purge is None:
                     should_purge = True
-                return SnapshotImportContext(self, context_id, should_purge, encoding)
+                return SnapshotImportContext(self, context_id, should_purge,
+                                             encoding)
 
         if archive is not None:
             return TarballImportContext(tool=self,
@@ -1081,7 +1088,8 @@
 
             messages = {}
 
-            event.notify(BeforeProfileImportEvent(self, profile_id, steps, True))
+            event.notify(
+                BeforeProfileImportEvent(self, profile_id, steps, True))
             for step in steps:
                 message = self._doRunImportStep(step, context)
                 message_list = filter(None, [message])

Modified: Products.GenericSetup/trunk/Products/GenericSetup/zcml.py
===================================================================
--- Products.GenericSetup/trunk/Products/GenericSetup/zcml.py	2012-02-28 22:23:33 UTC (rev 124482)
+++ Products.GenericSetup/trunk/Products/GenericSetup/zcml.py	2012-02-28 23:39:59 UTC (rev 124483)
@@ -239,7 +239,8 @@
         required=False)
 
 
-class IUpgradeStepDirective(IUpgradeStepsDirective, IUpgradeStepsStepSubDirective):
+class IUpgradeStepDirective(IUpgradeStepsDirective,
+                            IUpgradeStepsStepSubDirective):
 
     """
     Define a standalone upgrade step
@@ -294,22 +295,23 @@
     """
 
 
-def upgradeStep(_context, title, profile, handler, description=None, source='*',
-                destination='*', sortkey=0, checker=None):
-    step = UpgradeStep(title, profile, source, destination, description, handler,
-                       checker, sortkey)
+def upgradeStep(_context, title, profile, handler, description=None,
+                source='*', destination='*', sortkey=0, checker=None):
+    step = UpgradeStep(title, profile, source, destination, description,
+                       handler, checker, sortkey)
     _context.action(
         discriminator=('upgradeStep', source, destination, handler, sortkey),
         callable=_registerUpgradeStep,
         args=(step,),
         )
 
-def upgradeDepends(_context, title, profile, description=None, import_profile=None,
-                   import_steps=[], source='*', destination='*',
-                   run_deps=False, purge=False, checker=None, sortkey=0):
+def upgradeDepends(_context, title, profile, description=None,
+                   import_profile=None, import_steps=[], source='*',
+                   destination='*', run_deps=False, purge=False, checker=None,
+                   sortkey=0):
     step = UpgradeDepends(title, profile, source, destination, description,
-                          import_profile, import_steps, run_deps, purge, checker,
-                          sortkey)
+                          import_profile, import_steps, run_deps, purge,
+                          checker, sortkey)
     _context.action(
         discriminator=('upgradeDepends', source, destination, import_profile,
                        str(import_steps), checker, sortkey),
@@ -324,7 +326,8 @@
     Allows nested upgrade steps.
     """
 
-    def __init__(self, _context, profile, source='*', destination='*', sortkey=0):
+    def __init__(self, _context, profile, source='*', destination='*',
+                 sortkey=0):
         self.profile = profile
         self.source = source
         self.dest = destination
@@ -346,19 +349,19 @@
             args=(step, self.id),
             )
 
-    def upgradeDepends(self, _context, title, description=None, import_profile=None,
-                       import_steps=[], run_deps=False, purge=False,
-                       checker=None):
+    def upgradeDepends(self, _context, title, description=None,
+                       import_profile=None, import_steps=[], run_deps=False,
+                       purge=False, checker=None):
         """ nested upgradeDepends directive """
         step = UpgradeDepends(title, self.profile, self.source, self.dest,
-                              description, import_profile, import_steps, run_deps,
-                              purge, checker, self.sortkey)
+                              description, import_profile, import_steps,
+                              run_deps, purge, checker, self.sortkey)
         if self.id is None:
             self.id = str(abs(hash('%s%s%s%s' % (title, self.source, self.dest,
                                                  self.sortkey))))
         _context.action(
-            discriminator=('upgradeDepends', self.source, self.dest, import_profile,
-                           str(import_steps), self.sortkey),
+            discriminator=('upgradeDepends', self.source, self.dest,
+                           import_profile, str(import_steps), self.sortkey),
             callable=_registerNestedUpgradeStep,
             args=(step, self.id)
             )



More information about the checkins mailing list