[Checkins] SVN: zope.publisher/trunk/ Move `getDefaultSkin` to the skinnable module next to the `setDefaultSkin` method, leaving a BBB import in place. Mark `IDefaultBrowserLayer` as a `IBrowserSkinType` in code instead of relying on the ZCML to be loaded.

Hanno Schlichting hannosch at hannosch.eu
Sun Apr 26 10:10:34 EDT 2009


Log message for revision 99516:
  Move `getDefaultSkin` to the skinnable module next to the `setDefaultSkin` method, leaving a BBB import in place. Mark `IDefaultBrowserLayer` as a `IBrowserSkinType` in code instead of relying on the ZCML to be loaded.
  

Changed:
  U   zope.publisher/trunk/CHANGES.txt
  U   zope.publisher/trunk/src/zope/publisher/browser.py
  U   zope.publisher/trunk/src/zope/publisher/configure.zcml
  U   zope.publisher/trunk/src/zope/publisher/interfaces/browser.py
  U   zope.publisher/trunk/src/zope/publisher/skinnable.py

-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt	2009-04-26 13:28:09 UTC (rev 99515)
+++ zope.publisher/trunk/CHANGES.txt	2009-04-26 14:10:34 UTC (rev 99516)
@@ -4,13 +4,15 @@
 3.6.4 (unreleased)
 ------------------
 
-- ...
+- Move `getDefaultSkin` to the skinnable module next to the `setDefaultSkin`
+  method, leaving a BBB import in place. Mark `IDefaultBrowserLayer` as a
+  `IBrowserSkinType` in code instead of relying on the ZCML to be loaded.
 
 3.6.3 (2009-03-18)
 ------------------
 
-- Mark HTTPRequest as IAttributeAnnotatable if ``zope.annotation`` is available,
-  this was previously done by ``zope.app.i18n``.
+- Mark HTTPRequest as IAttributeAnnotatable if ``zope.annotation`` is
+  available, this was previously done by ``zope.app.i18n``.
 
 - Register `IHTTPRequest` -> `IUserPreferredCharsets` adapter in ZCML
   configuration. This was also previously done by ``zope.app.i18n``.
@@ -22,12 +24,14 @@
   ``zope.publisher.interfaces.logginginfo.ILoggingInfo``. It was moved
   from ``zope.app.security`` as a part of refactoring process. 
 
-- Add adapters from HTTP and FTP request to ``zope.authentication.ILoginPassword``
-  interface. They are moved from ``zope.app.security`` as a part of refactoring
-  process. This change adds a dependency on the ``zope.authentication`` package,
-  but it's okay, since it's a tiny contract definition-only package.
+- Add adapters from HTTP and FTP request to
+  ``zope.authentication.ILoginPassword`` interface. They are moved from
+  ``zope.app.security`` as a part of refactoring process. This change adds a
+  dependency on the ``zope.authentication`` package, but it's okay, since it's
+  a tiny contract definition-only package.
 
-  See http://mail.zope.org/pipermail/zope-dev/2009-March/035325.html for reasoning.
+  See http://mail.zope.org/pipermail/zope-dev/2009-March/035325.html for
+  reasoning.
 
 3.6.1 (2009-03-09)
 ------------------

Modified: zope.publisher/trunk/src/zope/publisher/browser.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/browser.py	2009-04-26 13:28:09 UTC (rev 99515)
+++ zope.publisher/trunk/src/zope/publisher/browser.py	2009-04-26 14:10:34 UTC (rev 99516)
@@ -29,9 +29,7 @@
 
 import zope.component
 import zope.interface
-from zope.interface import implements, directlyProvides, alsoProvides
-from zope.interface import directlyProvidedBy, providedBy
-from zope.interface.interfaces import IInterface
+from zope.interface import implements, directlyProvides
 from zope.i18n.interfaces import IUserPreferredLanguages
 from zope.i18n.interfaces import IUserPreferredCharsets
 from zope.location import Location
@@ -50,6 +48,7 @@
 # BBB imports, this compoennts get moved from this module
 from zope.publisher.interfaces import ISkinType #BBB import
 from zope.publisher.interfaces import ISkinChangedEvent #BBB import
+from zope.publisher.skinnable import getDefaultSkin #BBB import
 from zope.publisher.skinnable import setDefaultSkin #BBB import
 from zope.publisher.skinnable import applySkin #BBB import
 from zope.publisher.skinnable import SkinChangedEvent #BBB import
@@ -915,8 +914,3 @@
     def __call__(self, *args, **kw):
         raise NotImplementedError("Subclasses should override __call__ to "
                                   "provide a response body")
-
-
-def getDefaultSkin(request):
-    """Returns the IDefaultSkin layer for IBrowserRequest."""
-    return IDefaultBrowserLayer

Modified: zope.publisher/trunk/src/zope/publisher/configure.zcml
===================================================================
--- zope.publisher/trunk/src/zope/publisher/configure.zcml	2009-04-26 13:28:09 UTC (rev 99515)
+++ zope.publisher/trunk/src/zope/publisher/configure.zcml	2009-04-26 14:10:34 UTC (rev 99516)
@@ -9,7 +9,6 @@
 
   <interface
       interface="zope.publisher.interfaces.browser.IDefaultBrowserLayer"
-      type="zope.publisher.interfaces.browser.IBrowserSkinType"
       />
 
   <class class="zope.publisher.http.HTTPRequest">

Modified: zope.publisher/trunk/src/zope/publisher/interfaces/browser.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/interfaces/browser.py	2009-04-26 13:28:09 UTC (rev 99515)
+++ zope.publisher/trunk/src/zope/publisher/interfaces/browser.py	2009-04-26 14:10:34 UTC (rev 99516)
@@ -18,8 +18,7 @@
 
 __docformat__ = "reStructuredText"
 
-from zope.interface import Interface, Attribute, directlyProvides, alsoProvides
-from zope.interface.interfaces import IInterface
+from zope.interface import Attribute, alsoProvides
 
 from zope.publisher.interfaces import IPublication
 from zope.publisher.interfaces import IPublishTraverse
@@ -125,9 +124,11 @@
         """Compute a response body"""
 
 
+class IBrowserSkinType(ISkinType):
+    """A skin is a set of layers."""
+
+
 class IDefaultBrowserLayer(IBrowserRequest):
     """The default layer."""
 
-
-class IBrowserSkinType(ISkinType):
-    """A skin is a set of layers."""
+alsoProvides(IDefaultBrowserLayer, IBrowserSkinType)

Modified: zope.publisher/trunk/src/zope/publisher/skinnable.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/skinnable.py	2009-04-26 13:28:09 UTC (rev 99515)
+++ zope.publisher/trunk/src/zope/publisher/skinnable.py	2009-04-26 14:10:34 UTC (rev 99516)
@@ -37,6 +37,11 @@
         self.request = request
 
 
+def getDefaultSkin(request):
+    """Returns the IDefaultSkin layer for IBrowserRequest."""
+    return interfaces.browser.IDefaultBrowserLayer
+
+
 def setDefaultSkin(request):
     """Sets the default skin for a given request."""
     adapters = zope.component.getSiteManager().adapters



More information about the Checkins mailing list