Commit 0c3ecbb0 authored by Hanno Schlichting's avatar Hanno Schlichting

Remove deprecated slated for removal in Zope 4.

Also adjust some deprecation warnings to refer to Zope 5.0.
parent 24d566b4
......@@ -15,56 +15,7 @@
o N.B.: DO NOT IMPORT ANYTHING HERE! This module is just for shared data!
"""
# BBB imports
from zope.deferredimport import deprecated
deprecated("import TreeDisplay directly",
TreeDisplay = "TreeDisplay",
)
deprecated("import from App.Common instead",
package_home = 'App.Common:package_home',
attrget = 'App.Common:attrget',
Dictionary = 'App.Common:Dictionary',
)
deprecated("import from Persistence instead",
Persistent = 'Persistence:Persistent',
PersistentMapping = 'Persistence:PersistentMapping',
)
deprecated("import from AccessControl.class_init instead",
InitializeClass = 'AccessControl.class_init:InitializeClass',
)
deprecated("import from AccessControl.Permission instead",
ApplicationDefaultPermissions =
'AccessControl.Permission:ApplicationDefaultPermissions',
)
deprecated("import from App.special_dtml instead",
HTML = 'App.special_dtml:HTML',
HTMLFile = 'App.special_dtml:HTMLFile',
DTMLFile = 'App.special_dtml:DTMLFile',
)
deprecated("import from App.Dialogs instead",
MessageDialog = 'App.Dialogs:MessageDialog',
)
deprecated("import from App.ImageFile instead",
ImageFile = 'App.ImageFile:ImageFile',
)
deprecated("import from OFS.ObjectManager instead",
UNIQUE = 'OFS.ObjectManager:UNIQUE',
REPLACEABLE = 'OFS.ObjectManager:REPLACEABLE',
NOT_REPLACEABLE = 'OFS.ObjectManager:NOT_REPLACEABLE',
)
del deprecated
DevelopmentMode = False
# XXX ZODB stashes the main database object here
# ZODB stashes the main database object here
opened = []
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.deferredimport import deprecated
deprecated("Please import from OFS.absoluteurl",
AbsoluteURL = 'OFS.absoluteurl:AbsoluteURL',
OFSTraversableAbsoluteURL = 'OFS.absoluteurl:OFSTraversableAbsoluteURL',
RootAbsoluteURL = 'OFS.absoluteurl:RootAbsoluteURL',
)
......@@ -20,10 +20,11 @@ from warnings import warn
from ZPublisher.HTTPRequest import isCGI_NAMEs
from zope.i18n.interfaces import IUserPreferredCharsets
# taken and adapted from zope.publisher.browser.BrowserRequest
def _decode(text, charsets):
"""Try to decode the text using one of the available charsets.
"""
# taken and adapted from zope.publisher.browser.BrowserRequest
for charset in charsets:
try:
text = unicode(text, charset)
......@@ -32,12 +33,13 @@ def _decode(text, charsets):
pass
return text
def processInputValue(value, charsets):
"""Recursively look for values (e.g. elements of lists, tuples or dicts)
and attempt to decode.
"""
warn(u'processInputValue() is deprecated and will be removed in Zope '
u'2.16.',
u'5.0.',
DeprecationWarning, stacklevel=2)
if isinstance(value, list):
......@@ -53,12 +55,13 @@ def processInputValue(value, charsets):
else:
return value
def processInputs(request, charsets=None):
"""Process the values in request.form to decode strings to unicode, using
the passed-in list of charsets. If none are passed in, look up the user's
preferred charsets. The default is to use utf-8.
"""
warn(u'processInputs() is deprecated and will be removed in Zope 2.16. If '
warn(u'processInputs() is deprecated and will be removed in Zope 5.0. If '
u'your view implements IBrowserPage, similar processing is now '
u'executed automatically.',
DeprecationWarning, stacklevel=2)
......@@ -74,12 +77,13 @@ def processInputs(request, charsets=None):
if not (name in isCGI_NAMEs or name.startswith('HTTP_')):
request.form[name] = processInputValue(value, charsets)
def setPageEncoding(request):
"""Set the encoding of the form page via the Content-Type header.
ZPublisher uses the value of this header to determine how to
encode unicode data for the browser.
"""
warn(u'setPageEncoding() is deprecated and will be removed in Zope 2.16. '
warn(u'setPageEncoding() is deprecated and will be removed in Zope 5.0. '
u'It is recommended to let the ZPublisher use the default_encoding. '
u'Please consider setting default-zpublisher-encoding to utf-8.',
DeprecationWarning, stacklevel=2)
......
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Some menu code
"""
import zope.deferredimport
zope.deferredimport.deprecated(
"The Five specific view has been made obsolete. Please use the "
"view from zope.browsermenu directly.",
MenuAccessView = 'zope.browsermenu.menu.MenuAccessView',
)
<configure xmlns="http://namespaces.zope.org/zope">
<!-- BBB shim -->
<include package="OFS" file="event.zcml"/>
</configure>
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.deferredimport import deprecated
deprecated("Please import from OFS.metaconfigure",
deprecatedManageAddDelete = 'OFS.metaconfigure:deprecatedManageAddDelete',
setDeprecatedManageAddDelete = \
'OFS.metaconfigure:setDeprecatedManageAddDelete',
)
......@@ -19,37 +19,19 @@ These directives are specific to Five and have no equivalents outside of it.
import logging
import os
import glob
import warnings
import sys
from App.config import getConfiguration
from zope.interface import classImplements
from zope.component.interface import provideInterface
from zope.configuration.exceptions import ConfigurationError
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from Products.Five.browser.metaconfigure import page
logger = logging.getLogger('Products.Five')
if sys.version_info >= (3, 0):
basestring = str
logger = logging.getLogger('Products.Five')
def implements(_context, class_, interface):
warnings.warn('Using <five:implements /> in %s is deprecated. Please use '
'the <class class="foo.Bar">'
'<implements interface="foo.interfaces.IBar" /></class> '
'directive instead.' % _context.info,
DeprecationWarning, stacklevel=2)
for interface in interface:
_context.action(
discriminator = None,
callable = classImplements,
args = (class_, interface)
)
_context.action(
discriminator = None,
callable = provideInterface,
args = (interface.__module__ + '.' + interface.getName(),
interface)
)
def pagesFromDirectory(_context, directory, module, for_=None,
layer=IDefaultBrowserLayer, permission='zope.Public'):
......@@ -63,7 +45,7 @@ def pagesFromDirectory(_context, directory, module, for_=None,
if not os.path.isdir(directory):
raise ConfigurationError(
"Directory %s does not exist" % directory
)
)
for fname in glob.glob(os.path.join(directory, '*.pt')):
name = os.path.splitext(os.path.basename(fname))[0]
......@@ -77,19 +59,3 @@ def handleBrokenProduct(product):
raise
# Not debug mode. Zope should continue to load. Print a log message:
logger.exception('Could not import Product %s' % product.__name__)
from zope.deferredimport import deprecated
deprecated("Please import from OFS.metaconfigure",
findProducts = 'OFS.metaconfigure:findProducts',
loadProducts = 'OFS.metaconfigure:loadProducts',
loadProductsOverrides = 'OFS.metaconfigure:loadProductsOverrides',
_register_monkies = 'OFS.metaconfigure:_register_monkies',
_meta_type_regs = 'OFS.metaconfigure:_meta_type_regs',
_registerClass = 'OFS.metaconfigure:_registerClass',
registerClass = 'OFS.metaconfigure:registerClass',
_registerPackage = 'OFS.metaconfigure:_registerPackage',
registerPackage = 'OFS.metaconfigure:registerPackage',
unregisterClass = 'OFS.metaconfigure:unregisterClass',
)
......@@ -16,26 +16,10 @@
from zope.interface import Interface
from zope.browserresource.metadirectives import IBasicResourceInformation
from zope.configuration.fields import GlobalObject, Tokens
from zope.configuration.fields import GlobalObject
from zope.schema import TextLine
# Deprecated, the class directive from zope.security allows the same
class IImplementsDirective(Interface):
"""State that a class implements something.
"""
class_ = GlobalObject(
title=u"Class",
required=True
)
interface = Tokens(
title=u"One or more interfaces",
required=True,
value_type=GlobalObject()
)
class ISizableDirective(Interface):
"""Attach sizable adapters to classes.
"""
......@@ -43,7 +27,7 @@ class ISizableDirective(Interface):
class_ = GlobalObject(
title=u"Class",
required=True
)
)
class IPagesFromDirectoryDirective(IBasicResourceInformation):
......@@ -53,29 +37,15 @@ class IPagesFromDirectoryDirective(IBasicResourceInformation):
for_ = GlobalObject(
title=u"The interface this view is for.",
required=False
)
)
module = GlobalObject(
title=u"Module",
required=True
)
)
directory = TextLine(
title=u"Directory",
description=u"The directory containing the resource data.",
required=True
)
from zope.deferredimport import deprecated
deprecated("Please import from OFS.metadirectives",
IRegisterPackageDirective = 'OFS.metadirectives:IRegisterPackageDirective',
IRegisterClassDirective = 'OFS.metadirectives:IRegisterClassDirective',
IDeprecatedManageAddDeleteDirective = \
'OFS.metadirectives:IDeprecatedManageAddDeleteDirective',
)
deprecated("Please import from zope.configuration.xmlconfig",
IInclude = 'zope.configuration.xmlconfig:IInclude',
)
)
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Five interfaces
"""
from zope.deferredimport import deprecated
deprecated("Please import from zope.browsermenu.interfaces",
IMenuItemType = 'zope.browsermenu.interfaces:IMenuItemType',
)
......@@ -21,13 +21,6 @@
handler=".fiveconfigure.pagesFromDirectory"
/>
<!-- Deprecated, use the class directive instead. -->
<meta:directive
name="implements"
schema=".fivedirectives.IImplementsDirective"
handler=".fiveconfigure.implements"
/>
</meta:directives>
</configure>
# BBB
from AccessControl.metaconfigure import ClassDirective
# BBB Zope 5.0
from zope.deferredimport import deprecated
deprecated(
'Please import from AccessControl.metaconfigure',
ClassDirective='AccessControl.metaconfigure:ClassDirective',
)
# BBB
from zope.deferredimport import deprecated
deprecated("Please import from Zope2.App.schema",
Zope2VocabularyRegistry = 'Zope2.App.schema:Zope2VocabularyRegistry',
)
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Five security handling
"""
from zope.deferredimport import deprecated
deprecated("Please import InitializeClass from App.class_init",
initializeClass = 'App.class_init:InitializeClass',
)
deprecated("Please import from AccessControl.security",
CheckerPublicId = 'AccessControl.security:CheckerPublicId',
CheckerPrivateId = 'AccessControl.security:CheckerPrivateId',
getSecurityInfo = 'AccessControl.security:getSecurityInfo',
clearSecurityInfo = 'AccessControl.security:clearSecurityInfo',
checkPermission = 'AccessControl.security:checkPermission',
FiveSecurityPolicy = 'AccessControl.security:SecurityPolicy',
newInteraction = 'AccessControl.security:newInteraction',
_getSecurity = 'AccessControl.security:_getSecurity',
protectName = 'AccessControl.security:protectName',
protectClass = 'AccessControl.security:protectClass',
)
# BBB
from zope.deferredimport import deprecated
deprecated("Please import from Testing.testbrowser",
PublisherConnection = 'Testing.testbrowser:PublisherConnection',
PublisherHTTPHandler = 'Testing.testbrowser:PublisherHTTPHandler',
PublisherMechanizeBrowser = 'Testing.testbrowser:PublisherMechanizeBrowser',
Browser = 'Testing.testbrowser:Browser',
)
# BBB
from zope.deferredimport import deprecated
deprecated("Please import from Zope2.App.zcml",
_context = 'Zope2.App.zcml:_context',
_initialized = 'Zope2.App.zcml:_initialized',
cleanUp = 'Zope2.App.zcml:cleanUp',
load_config = 'Zope2.App.zcml:load_config',
load_site = 'Zope2.App.zcml:load_site',
load_string = 'Zope2.App.zcml:load_string',
)
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""TaintedString legacy module.
"""
from zope.deferredimport import deprecated
deprecated('ZPublisher.TaintedString will be removed in Zope 4.0 Please '
'import from AccessControl.tainted instead.',
TaintedString = 'AccessControl.tainted:TaintedString',
)
......@@ -223,7 +223,7 @@
<key name="enable-product-installation" datatype="boolean" default="off">
<description>
BBB: This directive has no effect anymore.
BBB Zope 5.0: This directive has no effect anymore.
</description>
<metadefault>off</metadefault>
</key>
......
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