[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/demo/skinpref/skin.py Simplified code by using an existing helper function.

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Apr 2 07:47:27 EST 2005


Log message for revision 29839:
  Simplified code by using an existing helper function.
  

Changed:
  U   Zope3/trunk/src/zope/app/demo/skinpref/skin.py

-=-
Modified: Zope3/trunk/src/zope/app/demo/skinpref/skin.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/skinpref/skin.py	2005-04-02 09:26:12 UTC (rev 29838)
+++ Zope3/trunk/src/zope/app/demo/skinpref/skin.py	2005-04-02 12:47:27 UTC (rev 29839)
@@ -21,6 +21,7 @@
 from zope.publisher.interfaces.browser import ISkin
 from zope.app.component.interfaces import ISite
 from zope.app.preference.interfaces import IUserPreferences
+from zope.app.publisher.browser import applySkin as applySkinOnRequest
 
 def applySkin(event):
     # We only want to look for a new skin to set, if we entered a new site.
@@ -35,13 +36,5 @@
     if not skin or skin.providedBy(event.request):
         return
 
-    # Remove the old skin
-    for iface in zope.interface.directlyProvidedBy(event.request):
-        if ISkin.providedBy(iface):
-            zope.interface.directlyProvides(
-                event.request,
-                zope.interface.directlyProvidedBy(event.request)-iface)
-            break
-
-    # Add the new skin
-    zope.interface.alsoProvides(event.request, skin)
+    # Remove the old skin and apply new one
+    applySkinOnRequest(event.request, skin)



More information about the Zope3-Checkins mailing list