Commit a4aecadd authored by Andreas Jung's avatar Andreas Jung

deprecated OFS.content_types

parent 1b3fb5bb
...@@ -26,6 +26,9 @@ Zope Changes ...@@ -26,6 +26,9 @@ Zope Changes
Features added 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 - OFS.content_types: moved code to zope.app.content_types and added
method aliases method aliases
......
...@@ -17,15 +17,16 @@ __version__='$Revision: 1.20 $'[11:-2] ...@@ -17,15 +17,16 @@ __version__='$Revision: 1.20 $'[11:-2]
import os import os
import time import time
import Acquisition
import Globals
from Globals import InitializeClass from Globals import InitializeClass
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from App.config import getConfiguration from App.config import getConfiguration
from OFS.content_types import guess_content_type
from Globals import package_home from Globals import package_home
from Common import rfc1123_date from Common import rfc1123_date
from DateTime import DateTime from DateTime import DateTime
import Acquisition
import Globals from zope.app.content_types import guess_content_type
class ImageFile(Acquisition.Explicit): class ImageFile(Acquisition.Explicit):
"""Image objects stored in external files.""" """Image objects stored in external files."""
......
...@@ -17,7 +17,7 @@ $Id$ ...@@ -17,7 +17,7 @@ $Id$
from Globals import InitializeClass from Globals import InitializeClass
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
from Globals import HTML, DTMLFile, MessageDialog 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 DTMLMethod import DTMLMethod, decapitate
from PropertyManager import PropertyManager from PropertyManager import PropertyManager
from webdav.common import rfc1123_date from webdav.common import rfc1123_date
......
...@@ -18,7 +18,7 @@ import History ...@@ -18,7 +18,7 @@ import History
from Globals import HTML, DTMLFile, MessageDialog from Globals import HTML, DTMLFile, MessageDialog
from Globals import InitializeClass from Globals import InitializeClass
from SimpleItem import Item_w__name__, pretty_tb 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 PropertyManager import PropertyManager
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.Role import RoleManager from AccessControl.Role import RoleManager
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
$Id$ $Id$
""" """
import struct 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 DTMLFile
from Globals import InitializeClass from Globals import InitializeClass
from PropertyManager import PropertyManager from PropertyManager import PropertyManager
......
...@@ -15,4 +15,10 @@ ...@@ -15,4 +15,10 @@
$Id$ $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 from zope.app.content_types import text_type, guess_content_type, add_files
...@@ -19,13 +19,13 @@ import App.Dialogs, ZClasses, App.Factory, App.ProductRegistry ...@@ -19,13 +19,13 @@ import App.Dialogs, ZClasses, App.Factory, App.ProductRegistry
import ZClassOwner import ZClassOwner
from AccessControl.PermissionMapping import aqwrap, PermissionMapper from AccessControl.PermissionMapping import aqwrap, PermissionMapper
import OFS.content_types
from OFS.DTMLMethod import DTMLMethod from OFS.DTMLMethod import DTMLMethod
from Products.PythonScripts.PythonScript import PythonScript from Products.PythonScripts.PythonScript import PythonScript
from zExceptions import BadRequest from zExceptions import BadRequest
import marshal import marshal
from cgi import escape from cgi import escape
from zope.app.content_types import guess_content_type
_marker=[] _marker=[]
class ZClassMethodsSheet( class ZClassMethodsSheet(
...@@ -189,7 +189,7 @@ class ZClassMethodsSheet( ...@@ -189,7 +189,7 @@ class ZClassMethodsSheet(
new item uploaded via FTP/WebDAV. new item uploaded via FTP/WebDAV.
""" """
if typ is None: if typ is None:
typ, enc = OFS.content_types.guess_content_type() typ, enc = guess_content_type()
if typ == 'text/x-python': if typ == 'text/x-python':
return PythonScript( name ) return PythonScript( name )
if typ[ :4 ] == 'text': if typ[ :4 ] == 'text':
......
...@@ -17,9 +17,9 @@ $Id$ ...@@ -17,9 +17,9 @@ $Id$
import sys import sys
import Acquisition, OFS.content_types import Acquisition
from Globals import InitializeClass
import OFS.SimpleItem import OFS.SimpleItem
from Globals import InitializeClass
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import view as View from AccessControl.Permissions import view as View
...@@ -39,6 +39,8 @@ from interfaces import IWriteLock ...@@ -39,6 +39,8 @@ from interfaces import IWriteLock
from Resource import Resource from Resource import Resource
from WriteLockInterface import WriteLockInterface from WriteLockInterface import WriteLockInterface
from zope.app.content_types import guess_content_type
class NullResource(Persistent, Acquisition.Implicit, Resource): class NullResource(Persistent, Acquisition.Implicit, Resource):
...@@ -143,7 +145,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource): ...@@ -143,7 +145,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
typ=REQUEST.get_header('content-type', None) typ=REQUEST.get_header('content-type', None)
if typ is 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 ) factory = getattr(parent, 'PUT_factory', self._default_PUT_factory )
ob = factory(name, typ, body) ob = factory(name, typ, body)
...@@ -409,7 +411,7 @@ class LockNullResource(NullResource, OFS.SimpleItem.Item_w__name__): ...@@ -409,7 +411,7 @@ class LockNullResource(NullResource, OFS.SimpleItem.Item_w__name__):
body = REQUEST.get('BODY', '') body = REQUEST.get('BODY', '')
typ = REQUEST.get_header('content-type', None) typ = REQUEST.get_header('content-type', None)
if typ is 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) factory = getattr(parent, 'PUT_factory', self._default_PUT_factory)
ob = (factory(name, typ, body) or ob = (factory(name, typ, body) or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment