[Zope3-checkins] SVN: Zope3/branches/Zope-3.1/src/zope/ Backported
rev 3627, 37637, 37639, and 37640 from the trunk. Those are
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Aug 1 17:15:23 EDT 2005
Log message for revision 37641:
Backported rev 3627, 37637, 37639, and 37640 from the trunk. Those are
fixes for the book to work a little bit better, iow all tests pass.
Changed:
A Zope3/branches/Zope-3.1/src/zope/app/component/bbb/hooks.py
U Zope3/branches/Zope-3.1/src/zope/app/component/bbb/localservice.py
U Zope3/branches/Zope-3.1/src/zope/app/component/hooks.py
U Zope3/branches/Zope-3.1/src/zope/app/container/browser/metaconfigure.py
U Zope3/branches/Zope-3.1/src/zope/app/file/interfaces.py
U Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/viewmeta.py
U Zope3/branches/Zope-3.1/src/zope/app/testing/setup.py
U Zope3/branches/Zope-3.1/src/zope/app/utility/utility.py
U Zope3/branches/Zope-3.1/src/zope/publisher/browser.py
-=-
Copied: Zope3/branches/Zope-3.1/src/zope/app/component/bbb/hooks.py (from rev 37637, Zope3/trunk/src/zope/app/component/bbb/hooks.py)
Property changes on: Zope3/branches/Zope-3.1/src/zope/app/component/bbb/hooks.py
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope3/branches/Zope-3.1/src/zope/app/component/bbb/localservice.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/component/bbb/localservice.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/component/bbb/localservice.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -19,3 +19,13 @@
('queryNextService', 'getNextService'),
'The concept of services has been removed. Use utilities instead. '
'The reference will be gone in X3.3.')
+
+
+def setSite(site=None):
+ from zope.app.component import hooks
+ return hooks.setSite(site)
+
+zope.deprecation.deprecated(
+ 'setSite',
+ "`setSite()`'s official location is in `zope.app.component.site`."
+ "The reference will be gone in X3.3.")
Modified: Zope3/branches/Zope-3.1/src/zope/app/component/hooks.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/component/hooks.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/component/hooks.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -18,6 +18,7 @@
__docformat__ = 'restructuredtext'
import zope.component
+import zope.deprecation
import zope.thread
import zope.security
@@ -100,9 +101,15 @@
def setHooks():
zope.component.adapter_hook.sethook(adapter_hook)
zope.component.getSiteManager.sethook(getSiteManager)
+ # BBB: Goes away in 3.3.
+ zope.deprecation.__show__.off()
+ from bbb import hooks
+ zope.component.getServices.sethook(hooks.getServices_hook)
+ zope.deprecation.__show__.on()
def resetHooks():
# Reset hookable functions to original implementation.
zope.component.adapter_hook.reset()
zope.component.getSiteManager.reset()
-
+ # BBB: Goes away in 3.3.
+ zope.component.getServices.reset()
Modified: Zope3/branches/Zope-3.1/src/zope/app/container/browser/metaconfigure.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/container/browser/metaconfigure.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/container/browser/metaconfigure.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -20,7 +20,7 @@
from zope.app.component.fields import LayerField
from zope.interface import Interface
-from zope.configuration.fields import GlobalInterface
+from zope.configuration.fields import GlobalObject
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.schema import Id
from zope.app.publisher.browser.viewmeta import page, view
@@ -33,11 +33,11 @@
class IContainerViews(Interface):
"""Define several container views for an `IContainer` implementation."""
- for_ = GlobalInterface(
- title=u"The interface this containerViews are for.",
+ for_ = GlobalObject(
+ title=u"The declaration this containerViews are for.",
description=u"""
The containerViews will be available for all objects that
- implement this interface.
+ provide this declaration.
""",
required=True)
Modified: Zope3/branches/Zope-3.1/src/zope/app/file/interfaces.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/file/interfaces.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/file/interfaces.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -21,6 +21,15 @@
from zope.interface import Interface
from zope.app.i18n import ZopeMessageIDFactory as _
+
+# BBB: To go away in 3.3
+from zope.app.publication.interfaces import IFileContent
+from zope.deprecation import deprecated
+deprecated('IFileContent',
+ '`IFileContent` has moved `zope.app.publication.interfaces`. '
+ 'This will go away in 3.3.')
+
+
class IFile(Interface):
contentType = BytesLine(
Modified: Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/viewmeta.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/viewmeta.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/publisher/browser/viewmeta.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -94,6 +94,18 @@
attribute='__call__', menu=None, title=None,
):
+ # BBB: Goes away in 3.3.
+ # Handle old default layer code. Code that reused the page directive will
+ # send a string.
+ if layer == 'default':
+ import warnings
+ warnings.warn(
+ 'Strings as layer names are not supported anymore. In the case '
+ 'of the `default` layer, please use the `IDefaultBrowserLayer` '
+ 'instead. This support goes away in Zope 3.3.',
+ DeprecationWarning, 2)
+ layer = IDefaultBrowserLayer
+
_handle_menu(_context, menu, title, [for_], name, permission, layer)
required = {}
Modified: Zope3/branches/Zope-3.1/src/zope/app/testing/setup.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/testing/setup.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/testing/setup.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -50,6 +50,14 @@
zapi.traverse(default.registrationManager, key).status = ActiveStatus
return default[name+suffix]
+def createServiceManager(folder, setsite=False):
+ return createSiteManager(folder, setsite)
+
+zope.deprecation.deprecated(
+ 'createServiceManager',
+ '`ServiceManager`s became `SiteManager`s. Use `createSiteManager` '
+ 'instead. Gone in Zope 3.3.')
+
#############################################################################
#------------------------------------------------------------------------
Modified: Zope3/branches/Zope-3.1/src/zope/app/utility/utility.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/app/utility/utility.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/app/utility/utility.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -39,8 +39,21 @@
class LocalUtilityService(Persistent, Contained):
# I really hope noone noone is using this class manually!
- pass
+ # ...6 months later: Yes, my book does. :(
+ def getUtilitiesFor(self, interface):
+ sm = self.__parent__.__parent__
+ return sm.getUtilitiesFor(interface)
+
+ def getUtility(self, interface, name=''):
+ sm = self.__parent__.__parent__
+ return sm.queryUtility(interface, name)
+
+ def queryUtility(self, interface, name='', default=None):
+ sm = self.__parent__.__parent__
+ return sm.queryUtility(interface, name, default)
+
+
deprecated('LocalUtilityService',
'Services have been removed. Use site manager API. '
'The reference will be gone in X3.3.')
Modified: Zope3/branches/Zope-3.1/src/zope/publisher/browser.py
===================================================================
--- Zope3/branches/Zope-3.1/src/zope/publisher/browser.py 2005-08-01 21:08:31 UTC (rev 37640)
+++ Zope3/branches/Zope-3.1/src/zope/publisher/browser.py 2005-08-01 21:15:22 UTC (rev 37641)
@@ -629,6 +629,15 @@
if form:
self.form.update(form)
+ # Setup locale object
+ langs = BrowserLanguages(self).getPreferredLanguages()
+ from zope.i18n.locales import locales
+ if not langs or langs[0] == '':
+ self._locale = locales.getLocale(None, None, None)
+ else:
+ parts = (langs[0].split('-') + [None, None])[:3]
+ self._locale = locales.getLocale(*parts)
+
if skin is not None:
directlyProvides(self, skin)
else:
More information about the Zope3-Checkins
mailing list