[Zope-Checkins] SVN: Zope/trunk/ deprecated OFS.content_types

Andreas Jung andreas at andreas-jung.com
Tue Dec 13 02:30:22 EST 2005


Log message for revision 40762:
  deprecated OFS.content_types
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/App/ImageFile.py
  U   Zope/trunk/lib/python/OFS/DTMLDocument.py
  U   Zope/trunk/lib/python/OFS/DTMLMethod.py
  U   Zope/trunk/lib/python/OFS/Image.py
  U   Zope/trunk/lib/python/OFS/content_types.py
  U   Zope/trunk/lib/python/ZClasses/Method.py
  U   Zope/trunk/lib/python/webdav/NullResource.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/doc/CHANGES.txt	2005-12-13 07:30:22 UTC (rev 40762)
@@ -26,6 +26,9 @@
 
     Features added
 
+      - deprecated OFS.content_types (to be removed in Zope 2.11) and
+        replaced all occurences with zope.app.content_types 
+
       - OFS.content_types: moved code to zope.app.content_types and added
         method aliases
 

Modified: Zope/trunk/lib/python/App/ImageFile.py
===================================================================
--- Zope/trunk/lib/python/App/ImageFile.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/App/ImageFile.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -17,16 +17,17 @@
 import os
 import time
 
+import Acquisition
+import Globals
 from Globals import InitializeClass
 from AccessControl import ClassSecurityInfo
 from App.config import getConfiguration
-from OFS.content_types import guess_content_type
 from Globals import package_home
 from Common import rfc1123_date
 from DateTime import DateTime
-import Acquisition
-import Globals
 
+from zope.app.content_types import guess_content_type
+
 class ImageFile(Acquisition.Explicit):
     """Image objects stored in external files."""
 

Modified: Zope/trunk/lib/python/OFS/DTMLDocument.py
===================================================================
--- Zope/trunk/lib/python/OFS/DTMLDocument.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/OFS/DTMLDocument.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -17,7 +17,7 @@
 from Globals import InitializeClass
 from ZPublisher.Converters import type_converters
 from Globals import HTML, DTMLFile, MessageDialog
-from OFS.content_types import guess_content_type
+from zope.app.content_types import guess_content_type
 from DTMLMethod import DTMLMethod, decapitate
 from PropertyManager import PropertyManager
 from webdav.common import rfc1123_date

Modified: Zope/trunk/lib/python/OFS/DTMLMethod.py
===================================================================
--- Zope/trunk/lib/python/OFS/DTMLMethod.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/OFS/DTMLMethod.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -18,7 +18,7 @@
 from Globals import HTML, DTMLFile, MessageDialog
 from Globals import InitializeClass
 from SimpleItem import Item_w__name__, pretty_tb
-from OFS.content_types import guess_content_type
+from zope.app.content_types import guess_content_type
 from PropertyManager import PropertyManager
 from AccessControl import ClassSecurityInfo
 from AccessControl.Role import RoleManager

Modified: Zope/trunk/lib/python/OFS/Image.py
===================================================================
--- Zope/trunk/lib/python/OFS/Image.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/OFS/Image.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -15,7 +15,7 @@
 $Id$
 """
 import struct
-from OFS.content_types import guess_content_type
+from zope.app.content_types import guess_content_type
 from Globals import DTMLFile
 from Globals import InitializeClass
 from PropertyManager import PropertyManager

Modified: Zope/trunk/lib/python/OFS/content_types.py
===================================================================
--- Zope/trunk/lib/python/OFS/content_types.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/OFS/content_types.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -15,4 +15,10 @@
 $Id$
 """
 
+import warnings
+warnings.warn('Using OFS.content_types is deprecated (will be removed in Zope '
+              '2.11). Instead use zope.app.content_types.', 
+              DeprecationWarning,
+              stacklevel=2) 
+
 from zope.app.content_types import text_type, guess_content_type, add_files

Modified: Zope/trunk/lib/python/ZClasses/Method.py
===================================================================
--- Zope/trunk/lib/python/ZClasses/Method.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/ZClasses/Method.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -19,13 +19,13 @@
 import ZClassOwner
 from AccessControl.PermissionMapping import aqwrap, PermissionMapper
 
-import OFS.content_types
 from OFS.DTMLMethod import DTMLMethod
 from Products.PythonScripts.PythonScript import PythonScript
 from zExceptions import BadRequest
 
 import marshal
 from cgi import escape
+from zope.app.content_types import guess_content_type
 
 _marker=[]
 class ZClassMethodsSheet(
@@ -189,7 +189,7 @@
             new item uploaded via FTP/WebDAV.
         """
         if typ is None:
-            typ, enc = OFS.content_types.guess_content_type()
+            typ, enc = guess_content_type()
         if typ == 'text/x-python':
             return PythonScript( name )
         if typ[ :4 ] == 'text':

Modified: Zope/trunk/lib/python/webdav/NullResource.py
===================================================================
--- Zope/trunk/lib/python/webdav/NullResource.py	2005-12-13 07:14:42 UTC (rev 40761)
+++ Zope/trunk/lib/python/webdav/NullResource.py	2005-12-13 07:30:22 UTC (rev 40762)
@@ -17,9 +17,9 @@
 
 import sys
 
-import Acquisition, OFS.content_types
+import Acquisition 
+import OFS.SimpleItem
 from Globals import InitializeClass
-import OFS.SimpleItem
 from AccessControl import getSecurityManager
 from AccessControl import ClassSecurityInfo
 from AccessControl.Permissions import view as View
@@ -39,7 +39,9 @@
 from Resource import Resource
 from WriteLockInterface import WriteLockInterface
 
+from zope.app.content_types import guess_content_type
 
+
 class NullResource(Persistent, Acquisition.Implicit, Resource):
 
     """Null resources are used to handle HTTP method calls on
@@ -143,7 +145,7 @@
 
         typ=REQUEST.get_header('content-type', None)
         if typ is None:
-            typ, enc=OFS.content_types.guess_content_type(name, body)
+            typ, enc=guess_content_type(name, body)
 
         factory = getattr(parent, 'PUT_factory', self._default_PUT_factory )
         ob = factory(name, typ, body)
@@ -409,7 +411,7 @@
         body = REQUEST.get('BODY', '')
         typ = REQUEST.get_header('content-type', None)
         if typ is None:
-            typ, enc = OFS.content_types.guess_content_type(name, body)
+            typ, enc = guess_content_type(name, body)
 
         factory = getattr(parent, 'PUT_factory', self._default_PUT_factory)
         ob = (factory(name, typ, body) or



More information about the Zope-Checkins mailing list