r13304 - in Products.Relations/trunk: . Products/Relations Products/Relations/components Products/Relations/tests

"Eric Steele" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: esteele
Date: Tue Nov 30 20:46:33 2010
New Revision: 13304

Modified:
   Products.Relations/trunk/Products/Relations/brain.py
   Products.Relations/trunk/Products/Relations/components/cardinality.py
   Products.Relations/trunk/Products/Relations/components/contentreference.py
   Products.Relations/trunk/Products/Relations/components/inverse.py
   Products.Relations/trunk/Products/Relations/components/types.py
   Products.Relations/trunk/Products/Relations/field.py
   Products.Relations/trunk/Products/Relations/interfaces.py
   Products.Relations/trunk/Products/Relations/processor.py
   Products.Relations/trunk/Products/Relations/ruleset.py
   Products.Relations/trunk/Products/Relations/tests/testRuleset.py
   Products.Relations/trunk/Products/Relations/utils.py
   Products.Relations/trunk/setup.py
Log:
Revert 13105,13106 so that I can merge in the 4.0-compat branch.

Modified: Products.Relations/trunk/Products/Relations/brain.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/brain.py	(original)
+++ Products.Relations/trunk/Products/Relations/brain.py	Tue Nov 30 20:46:33 2010
@@ -1,5 +1,3 @@
-from zope.interface import implements
-
 from AccessControl import ModuleSecurityInfo
 from Acquisition import aq_base
 from Globals import InitializeClass
@@ -20,7 +18,7 @@
     """Catalog brain kind of object that aggregates metadata from multiple
     catalogs."""
 
-    implements(interfaces.IBrainAggregate)
+    __implements__ = interfaces.IBrainAggregate,
     __allow_access_to_unprotected_subobjects__ = 1
 
     def __init__(self, brain, sources):
@@ -97,7 +95,7 @@
     return aggr
 
 class ReferenceWithBrains(Reference):
-    implements(interfaces.IReferenceWithBrains)
+    __implements__ = interfaces.IReferenceWithBrains
 
 # These proxy methods all make use of a volatile attribute to store their value
 # The dict maps method names, e.g. 'getSourceBrain', to functions that produce

Modified: Products.Relations/trunk/Products/Relations/components/cardinality.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/components/cardinality.py	(original)
+++ Products.Relations/trunk/Products/Relations/components/cardinality.py	Tue Nov 30 20:46:33 2010
@@ -1,6 +1,4 @@
 # -*- coding: utf-8 -*-
-from zope.interface import implements
-
 from Products.CMFCore.utils import getToolByName
 from Products.Archetypes.public import *
 from Products.Archetypes.exceptions import ReferenceException
@@ -11,7 +9,9 @@
 
 class CardinalityConstraint(BaseContent, ruleset.RuleBase):
     """An IValidator and IReferenceLayerProvider that enforces cardinality."""
-    implements(interfaces.IValidator, interfaces.IReferenceLayerProvider)
+    __implements__ = BaseContent.__implements__ + \
+                     (interfaces.IValidator,
+                      interfaces.IReferenceLayerProvider)
 
     content_icon = 'cardinalityconstraint_icon.gif'
 
@@ -96,11 +96,11 @@
         ))
     portal_type = 'Cardinality Constraint'
 
-registerType(CardinalityConstraint, PROJECTNAME)
+registerType(CardinalityConstraint)
 
 
 class CardinalityReferenceLayer:
-    implements(interfaces.IReferenceLayerProvider)
+    __implements__ = interfaces.IReferenceLayerProvider,
 
     def __init__(self, ruleset, cc):
         self.ruleset = ruleset

Modified: Products.Relations/trunk/Products/Relations/components/contentreference.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/components/contentreference.py	(original)
+++ Products.Relations/trunk/Products/Relations/components/contentreference.py	Tue Nov 30 20:46:33 2010
@@ -1,5 +1,3 @@
-from zope.interface import implements
-
 from Globals import InitializeClass
 from AccessControl import getSecurityManager
 from Products.CMFCore.utils import getToolByName
@@ -35,7 +33,7 @@
 
     Note that portal objects associated with this reference are identified
     by a reference, not by containment."""
-    implements(IContentReference,)
+    __implements__ = Reference.__implements__ + (IContentReference,)
     
     portal_type = meta_type = "Relation ContentReference"
     
@@ -94,8 +92,9 @@
     References that I create conform to this module's
     IContentReference, which derives from
     Archetypes.interfaces.referenceengine.IContentReference."""
-    implements(interfaces.IPrimaryImplicator, interfaces.IFinalizer,
-                      interfaces.IReferenceActionProvider)
+    __implements__ = (interfaces.IPrimaryImplicator, interfaces.IFinalizer,
+                      interfaces.IReferenceActionProvider) + \
+                     BaseContent.__implements__
 
     def connect(self, source, target, metadata=None):
         impl = ruleset.DefaultPrimaryImplicator(self.getRuleset())
@@ -214,4 +213,4 @@
         return DisplayList(
             [(pt, pt) for pt in utils.getReferenceableTypes(self)])
 
-registerType(ContentReferenceFinalizer, PROJECTNAME)
+registerType(ContentReferenceFinalizer)

Modified: Products.Relations/trunk/Products/Relations/components/inverse.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/components/inverse.py	(original)
+++ Products.Relations/trunk/Products/Relations/components/inverse.py	Tue Nov 30 20:46:33 2010
@@ -1,5 +1,3 @@
-from zope.interface import implements
-
 from Acquisition import ImplicitAcquisitionWrapper, aq_parent
 from Products.CMFCore.utils import getToolByName
 from Products.Archetypes.public import *
@@ -15,7 +13,7 @@
 
 class InverseImplicator(BaseContent, ruleset.RuleBase):
     """Implicator that creates a reference from target to source."""
-    implements(interfaces.IImplicator)
+    __implements__ = (interfaces.IImplicator,) + BaseContent.__implements__
 
     content_icon = 'inverseimplicator_icon.gif'
 
@@ -69,7 +67,7 @@
         else:
             return None
 
-registerType(InverseImplicator, PROJECTNAME)
+registerType(InverseImplicator)
                        
         
 

Modified: Products.Relations/trunk/Products/Relations/components/types.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/components/types.py	(original)
+++ Products.Relations/trunk/Products/Relations/components/types.py	Tue Nov 30 20:46:33 2010
@@ -1,5 +1,4 @@
 """Components that validate against types and interfaces."""
-from zope.interface import implements
 
 from Products.CMFCore.utils import getToolByName
 from Products.Archetypes.public import *
@@ -11,7 +10,8 @@
 class PortalTypeConstraint(BaseContent, ruleset.RuleBase):
     """A validator and vocabulary provider, restricting sources and targets
     by portal type."""
-    implements(interfaces.IVocabularyProvider, interfaces.IValidator)
+    __implements__ = (interfaces.IVocabularyProvider, interfaces.IValidator) +\
+                     BaseContent.__implements__
 
     content_icon = 'portaltypeconstraint_icon.gif'
 
@@ -86,7 +86,7 @@
         return DisplayList(
             [(pt, pt) for pt in utils.getReferenceableTypes(self)])
 
-registerType(PortalTypeConstraint, PROJECTNAME)
+registerType(PortalTypeConstraint)
 
 class InterfaceConstraint(PortalTypeConstraint):
     """A validator and vocabulary provider, restricting sources and targets
@@ -129,6 +129,6 @@
         ))
     archetype_name = portal_type = 'Interface Constraint'
 
-registerType(InterfaceConstraint, PROJECTNAME)
+registerType(InterfaceConstraint)
 
     

Modified: Products.Relations/trunk/Products/Relations/field.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/field.py	(original)
+++ Products.Relations/trunk/Products/Relations/field.py	Tue Nov 30 20:46:33 2010
@@ -12,11 +12,10 @@
 from Products.Archetypes.utils import DisplayList
 from Products.Archetypes import config as atconfig
 
-#try:
-#    from Products.generator import i18n
-#except ImportError:
-#    from Products.Archetypes.generator import i18n
-from zope.i18n import translate
+try:
+    from Products.generator import i18n
+except ImportError:
+    from Products.Archetypes.generator import i18n
 
 from config import RELATIONS_LIBRARY
 import processor

Modified: Products.Relations/trunk/Products/Relations/interfaces.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/interfaces.py	(original)
+++ Products.Relations/trunk/Products/Relations/interfaces.py	Tue Nov 30 20:46:33 2010
@@ -6,7 +6,8 @@
 type IBrainAggregate, which comprises all information available from catalogs
 on an object.
 """
-from zope.interface import Interface, Attribute
+
+from Interface import Interface, Attribute
 from Products.Archetypes.interfaces.referenceengine import IReference
 
 

Modified: Products.Relations/trunk/Products/Relations/processor.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/processor.py	(original)
+++ Products.Relations/trunk/Products/Relations/processor.py	Tue Nov 30 20:46:33 2010
@@ -1,5 +1,3 @@
-from zope.interface import implements
-
 import transaction
 
 from AccessControl import ModuleSecurityInfo
@@ -16,7 +14,7 @@
 modulesec = ModuleSecurityInfo('Products.Relations.processor')
 
 class Chain(dict):
-    implements(interfaces.IChain)
+    __implements__ = interfaces.IChain,
     
     def __init__(self):
         self.added = []
@@ -29,11 +27,11 @@
 
 
 
+# module implements the interface
+__implements__ = interfaces.IReferenceConnectionProcessor,
 
 modulesec.declarePublic('process')
 def process(context, connect=(), disconnect=()):
-    # module implements the interface
-    implements(interfaces.IReferenceConnectionProcessor)
     sp = transaction.savepoint()
     try:
         return _process(context, connect, disconnect)

Modified: Products.Relations/trunk/Products/Relations/ruleset.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/ruleset.py	(original)
+++ Products.Relations/trunk/Products/Relations/ruleset.py	Tue Nov 30 20:46:33 2010
@@ -1,8 +1,6 @@
 from xml.dom import minidom
 from sets import Set
 
-from zope.interface import implements
-
 from Acquisition import ImplicitAcquisitionWrapper, aq_parent, aq_inner
 from Globals import InitializeClass
 import zExceptions
@@ -27,8 +25,9 @@
 import logging
 logger = logging.getLogger('Relations')
 
+
 class XMLImportExport:
-    implements(interfaces.IXMLImportExport),
+    __implements__ = interfaces.IXMLImportExport,
 
     schema=Schema((
         StringField('xml',
@@ -217,13 +216,13 @@
     pass
 
 class RuleBase(XMLImportExport):
-    implements(interfaces.IRule),
+    __implements__ = interfaces.IRule,
 
     global_allow = 0 # convenience
     def getRuleset(self): return aq_parent(aq_inner(self))
 
 class DefaultPrimaryImplicator(RuleBase):
-    implements(interfaces.IPrimaryImplicator),
+    __implements__ = interfaces.IPrimaryImplicator,
 
     referenceClass = RLMWithBrains
 
@@ -250,7 +249,8 @@
         
 class Ruleset(utils.AllowedTypesByIface, OrderedBaseFolder, XMLImportExport):
     """See IRuleset."""
-    implements(interfaces.IRuleset)
+    __implements__ = (interfaces.IRuleset,) +\
+                     OrderedBaseFolder.__implements__
 
     schema = schema.RulesetSchema
     portal_type = archetype_name = 'Ruleset'
@@ -342,8 +342,7 @@
             url = getRelURL(aq_parent(aq_inner(ref)), ref.getPhysicalPath())
             ref_ctl.catalog_object(ref, url, idxs=['relationship'])
 
-registerType(Ruleset, PROJECTNAME)
-
+registerType(Ruleset)
 
 
 class RulesetAwareContainer:
@@ -389,7 +388,8 @@
 class Library(RulesetAwareContainer, utils.AllowedTypesByIface,
               OrderedBaseFolder, XMLImportExport):
     """Registry for IRulesets. See ILibrary."""
-    implements(interfaces.ILibrary)
+    __implements__ = ((interfaces.ILibrary,) +
+                      (OrderedBaseFolder.__implements__, ))
                       
 
     schema = schema.BaseSchemaWithInvisibleId + XMLImportExport.schema
@@ -452,13 +452,14 @@
     def getFolder(self):
         return self
 
-registerType(Library, PROJECTNAME)
+registerType(Library)
 
 
 class RulesetCollection(RulesetAwareContainer, utils.AllowedTypesByIface,
                         OrderedBaseFolder, XMLImportExport):
     """A container for IRulesets that lives inside the library."""
-    implements(interfaces.IRulesetCollection)
+    __implements__ = (interfaces.IRulesetCollection,) + \
+                     OrderedBaseFolder.__implements__
 
     schema = schema.BaseSchemaWithInvisibleId + XMLImportExport.schema
     portal_type = archetype_name = 'Ruleset Collection'
@@ -471,4 +472,4 @@
             v = v + collection.getRulesets()
         return v
 
-registerType(RulesetCollection, PROJECTNAME)
+registerType(RulesetCollection)

Modified: Products.Relations/trunk/Products/Relations/tests/testRuleset.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/tests/testRuleset.py	(original)
+++ Products.Relations/trunk/Products/Relations/tests/testRuleset.py	Tue Nov 30 20:46:33 2010
@@ -4,8 +4,6 @@
 
 import transaction
 
-from zope.interface import implements
-
 from Products.PloneTestCase import PloneTestCase
     
 from OFS.SimpleItem import SimpleItem
@@ -182,15 +180,15 @@
 # A dummy component that implements all interfaces and stores argument values
 # to its methods inside self.calls, a dict that's keyed by methodnames.
 class DummyComponent(SimpleItem, rulesetmodule.RuleBase):
-    implements(interfaces.IVocabularyProvider,
-                  interfaces.IPrimaryImplicator,
-                  interfaces.IImplicator,
-                  interfaces.IValidator,
-                  interfaces.IFinalizer,
-                  interfaces.IReferenceActionProvider,
-                  interfaces.IReferenceLayerProvider,
-                  interfaces.IReferenceLayer, # not a component interface
-                  )
+    __implements__ = (interfaces.IVocabularyProvider,
+                      interfaces.IPrimaryImplicator,
+                      interfaces.IImplicator,
+                      interfaces.IValidator,
+                      interfaces.IFinalizer,
+                      interfaces.IReferenceActionProvider,
+                      interfaces.IReferenceLayerProvider,
+                      interfaces.IReferenceLayer, # not a component interface
+                      )
 
     # These methods will be generated. They don't do anything, just make
     # an entry in self.calls

Modified: Products.Relations/trunk/Products/Relations/utils.py
==============================================================================
--- Products.Relations/trunk/Products/Relations/utils.py	(original)
+++ Products.Relations/trunk/Products/Relations/utils.py	Tue Nov 30 20:46:33 2010
@@ -1,6 +1,6 @@
 from AccessControl import ModuleSecurityInfo
 from Acquisition import aq_base
-from zope.interface import implements
+from Interface import Implements
 from OFS.CopySupport import CopySource
 
 from Products.CMFCore.utils import getToolByName
@@ -103,7 +103,7 @@
     tool = getToolByName(context, 'archetype_tool')
     for data in tool.listRegisteredTypes():
         klass = data['klass']
-        klass.implements(kifaces)
+        kifaces = klass.__implements__
 
             
         # We now flatten the interfaces and get their unqualified names,
@@ -123,7 +123,6 @@
 
     return value
 
-
 def getReferenceableTypes(context):
     """Return a list of portal type strings, with all types in the
     types tool that are referenceable."""

Modified: Products.Relations/trunk/setup.py
==============================================================================
--- Products.Relations/trunk/setup.py	(original)
+++ Products.Relations/trunk/setup.py	Tue Nov 30 20:46:33 2010
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import os
 
-version = '0.9 (svn/trunk)'
+version = '0.8 (svn/trunk)'
 
 setup(name='Products.Relations',
       version=version,

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.