[Checkins] SVN: zope.publisher/trunk/ Added some BBB code to setDefaultSkin to allow IBrowserRequest's to continue to work without configuring any special adapter for IDefaultSkin. Lot's of code inside Zope2 relying on using the request object without tons of CA setup
Hanno Schlichting
hannosch at hannosch.eu
Sun Apr 26 10:29:37 EDT 2009
Log message for revision 99518:
Added some BBB code to setDefaultSkin to allow IBrowserRequest's to continue to work without configuring any special adapter for IDefaultSkin. Lot's of code inside Zope2 relying on using the request object without tons of CA setup
Changed:
U zope.publisher/trunk/CHANGES.txt
U zope.publisher/trunk/src/zope/publisher/skinnable.py
-=-
Modified: zope.publisher/trunk/CHANGES.txt
===================================================================
--- zope.publisher/trunk/CHANGES.txt 2009-04-26 14:17:03 UTC (rev 99517)
+++ zope.publisher/trunk/CHANGES.txt 2009-04-26 14:29:37 UTC (rev 99518)
@@ -4,6 +4,9 @@
3.6.4 (unreleased)
------------------
+- Added some BBB code to setDefaultSkin to allow IBrowserRequest's to continue
+ to work without configuring any special adapter for IDefaultSkin.
+
- 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.
Modified: zope.publisher/trunk/src/zope/publisher/skinnable.py
===================================================================
--- zope.publisher/trunk/src/zope/publisher/skinnable.py 2009-04-26 14:17:03 UTC (rev 99517)
+++ zope.publisher/trunk/src/zope/publisher/skinnable.py 2009-04-26 14:29:37 UTC (rev 99518)
@@ -51,6 +51,11 @@
# find a named ``default`` adapter providing IDefaultSkin as fallback
skin = adapters.lookup((zope.interface.providedBy(request),),
interfaces.IDefaultSkin, 'default')
+ if skin is None:
+ # Let's be nice and continue to work for IBrowserRequest's
+ # without relying on adapter registrations
+ if interfaces.browser.IBrowserRequest.providedBy(request):
+ skin = getDefaultSkin
if skin is not None:
try:
# the default fallback skin is registered as a named adapter
More information about the Checkins
mailing list