[Zope-CMF] Re: SVN: CMF/branches/1.6/ Avoid deprecation warnings with Zope 2.10.

Tres Seaver tseaver at palladion.com
Fri Jun 9 12:43:05 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Florent Guillaume wrote:
> Log message for revision 68537:
>   Avoid deprecation warnings with Zope 2.10.
> 
> Changed:
>   U   CMF/branches/1.6/CMFCore/FSFile.py
>   U   CMF/branches/1.6/DCWorkflow/Expression.py
> 
> -=-
> Modified: CMF/branches/1.6/CMFCore/FSFile.py
> ===================================================================
> --- CMF/branches/1.6/CMFCore/FSFile.py	2006-06-09 12:41:27 UTC (rev 68536)
> +++ CMF/branches/1.6/CMFCore/FSFile.py	2006-06-09 13:40:32 UTC (rev 68537)
> @@ -22,9 +22,14 @@
>  from OFS.Cache import Cacheable
>  from OFS.Image import File
>  try:
> -    from zope.app.content_types import guess_content_type
> -except ImportError: # BBB: for Zope < 2.9
> -    from OFS.content_types import guess_content_type
> +    from zope.contenttype import guess_content_type
> +except ImportError:
> +    # BBB: for Zope < 2.10
> +    try:
> +        from zope.app.content_types import guess_content_type
> +    except ImportError:
> +        # BBB: for Zope < 2.9
> +        from OFS.content_types import guess_content_type
>  
>  from DirectoryView import registerFileExtension
>  from DirectoryView import registerMetaType
> 
> Modified: CMF/branches/1.6/DCWorkflow/Expression.py
> ===================================================================
> --- CMF/branches/1.6/DCWorkflow/Expression.py	2006-06-09 12:41:27 UTC (rev 68536)
> +++ CMF/branches/1.6/DCWorkflow/Expression.py	2006-06-09 13:40:32 UTC (rev 68537)
> @@ -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.


Florent:  1.6 is explicitly supposed to work with Zope 2.8.  Have you
tested that this change doesn't break that (I don't think
'zope.contenttype.guessContentType' was importable in ZopeX3.0).

1.6 is a "stepping-stone" for projects which needed the new GenericSetup
features, but couldn't move all the way to CMF 2.0;  making it less
noisy under 2.10 has to give precedence to preserving BBB.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEiaUZ+gerLs4ltQ4RAmxEAJ4lYDMzW2Wnc6wUP9ZbAp8iP9aQkgCbBkWj
4vjYlv3ipHBNOxHgyAR1Rlo=
=u2Nf
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list