[CMF-checkins] SVN: CMF/branches/2.0/ Avoid deprecation warnings with Zope 2.10.

Florent Guillaume fg at nuxeo.com
Fri Jun 9 09:41:04 EDT 2006


Log message for revision 68538:
  Avoid deprecation warnings with Zope 2.10.

Changed:
  U   CMF/branches/2.0/CMFCore/FSFile.py
  U   CMF/branches/2.0/DCWorkflow/Expression.py

-=-
Modified: CMF/branches/2.0/CMFCore/FSFile.py
===================================================================
--- CMF/branches/2.0/CMFCore/FSFile.py	2006-06-09 13:40:32 UTC (rev 68537)
+++ CMF/branches/2.0/CMFCore/FSFile.py	2006-06-09 13:41:03 UTC (rev 68538)
@@ -20,7 +20,11 @@
 from AccessControl import ClassSecurityInfo
 from DateTime import DateTime
 from OFS.Cache import Cacheable
-from zope.app.content_types import guess_content_type
+try:
+    from zope.contenttype import guess_content_type
+except ImportError:
+    # BBB: for Zope 2.9
+    from zope.app.content_types import guess_content_type
 from OFS.Image import File
 
 from DirectoryView import registerFileExtension

Modified: CMF/branches/2.0/DCWorkflow/Expression.py
===================================================================
--- CMF/branches/2.0/DCWorkflow/Expression.py	2006-06-09 13:40:32 UTC (rev 68537)
+++ CMF/branches/2.0/DCWorkflow/Expression.py	2006-06-09 13:41:03 UTC (rev 68538)
@@ -24,9 +24,26 @@
 from Products.CMFCore.WorkflowCore import ObjectDeleted, ObjectMoved
 from Products.CMFCore.Expression import Expression
 from Products.PageTemplates.Expressions import getEngine
-from Products.PageTemplates.TALES import SafeMapping
 from Products.PageTemplates.Expressions import SecureModuleImporter
 
+
+# We don't import SafeMapping from Products.PageTemplates.TALES
+# because it's deprecated in Zope 2.10
+from MultiMapping import MultiMapping
+class SafeMapping(MultiMapping):
+    """Mapping with security declarations and limited method exposure.
+
+    Since it subclasses MultiMapping, this class can be used to wrap
+    one or more mapping objects.  Restricted Python code will not be
+    able to mutate the SafeMapping or the wrapped mappings, but will be
+    able to read any value.
+    """
+    __allow_access_to_unprotected_subobjects__ = 1
+    push = pop = None
+    _push = MultiMapping.push
+    _pop = MultiMapping.pop
+
+
 class StateChangeInfo:
     '''
     Provides information for expressions and scripts.



More information about the CMF-checkins mailing list