[Checkins] SVN: GenericSetup/branches/1.3/ - added warnings to old
code
Yvo Schubbe
y.2007- at wcm-solutions.de
Sun Jul 29 13:13:20 EDT 2007
Log message for revision 78468:
- added warnings to old code
Changed:
U GenericSetup/branches/1.3/CHANGES.txt
UU GenericSetup/branches/1.3/doc/configurators.txt
U GenericSetup/branches/1.3/registry.py
U GenericSetup/branches/1.3/utils.py
-=-
Modified: GenericSetup/branches/1.3/CHANGES.txt
===================================================================
--- GenericSetup/branches/1.3/CHANGES.txt 2007-07-29 16:44:46 UTC (rev 78467)
+++ GenericSetup/branches/1.3/CHANGES.txt 2007-07-29 17:13:19 UTC (rev 78468)
@@ -3,6 +3,11 @@
GenericSetup 1.3.1 (unreleased)
+ - utils: Added warnings to old code.
+ ImportConfiguratorBase and ExportConfiguratorBase will become deprecated
+ as soon as GenericSetup itself no longer uses them. HandlerBase is now
+ deprecated.
+
- components: Added 'components_xmlconfig.html' form.
This view allows to inspect and edit component registrations.
Modified: GenericSetup/branches/1.3/doc/configurators.txt
===================================================================
--- GenericSetup/branches/1.3/doc/configurators.txt 2007-07-29 16:44:46 UTC (rev 78467)
+++ GenericSetup/branches/1.3/doc/configurators.txt 2007-07-29 17:13:19 UTC (rev 78468)
@@ -1,3 +1,6 @@
+WARNING: PLEASE DON'T USE THE CONFIGURATOR PATTERN. THE RELATED BASE CLASSES
+WILL BECOME DEPRECATED AS SOON AS GENERICSETUP ITSELF NO LONGER USES THEM.
+
The Products.GenericSetup.utils.ImportConfiguratorBase class provides
a convenient shortcut for defining how an XML file should be parsed
and converted to a python dictionary. To use this, create a subclass
Property changes on: GenericSetup/branches/1.3/doc/configurators.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: GenericSetup/branches/1.3/registry.py
===================================================================
--- GenericSetup/branches/1.3/registry.py 2007-07-29 16:44:46 UTC (rev 78467)
+++ GenericSetup/branches/1.3/registry.py 2007-07-29 17:13:19 UTC (rev 78468)
@@ -16,6 +16,7 @@
"""
import os
from xml.sax import parseString
+from xml.sax.handler import ContentHandler
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
@@ -32,12 +33,12 @@
from interfaces import IProfileRegistry
from permissions import ManagePortal
from metadata import ProfileMetadata
-from utils import HandlerBase
from utils import _xmldir
from utils import _getDottedName
from utils import _resolveDottedName
from utils import _extractDocstring
+
class ImportStepRegistry( Implicit ):
""" Manage knowledge about steps to create / configure site.
@@ -539,6 +540,7 @@
InitializeClass( ToolsetRegistry )
+
class ProfileRegistry( Implicit ):
""" Track registered profiles.
@@ -650,8 +652,32 @@
_profile_registry = ProfileRegistry()
-class _ImportStepRegistryParser( HandlerBase ):
+#
+# XML parser
+#
+
+class _HandlerBase(ContentHandler):
+
+ _MARKER = object()
+
+ def _extract(self, attrs, key):
+ result = attrs.get(key, self._MARKER)
+
+ if result is self._MARKER:
+ return None
+
+ return self._encode(result)
+
+ def _encode(self, content):
+ if self._encoding is None:
+ return content
+
+ return content.encode(self._encoding)
+
+
+class _ImportStepRegistryParser(_HandlerBase):
+
security = ClassSecurityInfo()
security.declareObjectPrivate()
security.setDefaultAccess( 'deny' )
@@ -720,8 +746,9 @@
InitializeClass( _ImportStepRegistryParser )
-class _ExportStepRegistryParser( HandlerBase ):
+class _ExportStepRegistryParser(_HandlerBase):
+
security = ClassSecurityInfo()
security.declareObjectPrivate()
security.setDefaultAccess( 'deny' )
@@ -778,7 +805,7 @@
InitializeClass( _ExportStepRegistryParser )
-class _ToolsetParser( HandlerBase ):
+class _ToolsetParser(_HandlerBase):
security = ClassSecurityInfo()
security.declareObjectPrivate()
@@ -811,5 +838,4 @@
else:
raise ValueError, 'Unknown element %s' % name
-
InitializeClass( _ToolsetParser )
Modified: GenericSetup/branches/1.3/utils.py
===================================================================
--- GenericSetup/branches/1.3/utils.py 2007-07-29 16:44:46 UTC (rev 78467)
+++ GenericSetup/branches/1.3/utils.py 2007-07-29 17:13:19 UTC (rev 78468)
@@ -34,6 +34,7 @@
from Globals import package_home
from OFS.interfaces import IOrderedContainer
from zope.component import queryMultiAdapter
+from zope.deprecation import deprecated
from zope.interface import implements
from zope.interface import implementsOnly
from zope.interface import providedBy
@@ -123,6 +124,10 @@
return title, description
+deprecated('HandlerBase',
+ 'SAX based XML parsing is no longer supported by GenericSetup. '
+ 'HandlerBase will be removed in GenericSetup 1.5.')
+
class HandlerBase( ContentHandler ):
_encoding = None
@@ -155,7 +160,12 @@
return content.encode( self._encoding )
+##############################################################################
+# WARNING: PLEASE DON'T USE THE CONFIGURATOR PATTERN. THE RELATED BASE CLASSES
+# WILL BECOME DEPRECATED AS SOON AS GENERICSETUP ITSELF NO LONGER USES THEM.
+
class ImportConfiguratorBase(Implicit):
+ # old code, will become deprecated
""" Synthesize data from XML description.
"""
security = ClassSecurityInfo()
@@ -268,6 +278,7 @@
class ExportConfiguratorBase(Implicit):
+ # old code, will become deprecated
""" Synthesize XML description.
"""
security = ClassSecurityInfo()
@@ -287,6 +298,8 @@
InitializeClass(ExportConfiguratorBase)
+#
+##############################################################################
class _LineWrapper:
More information about the Checkins
mailing list