[Checkins] SVN: zope.browserresource/trunk/src/zope/browserresource/icon.py Don't use getResource for IconView url method, instead get the resource like Resource view does.

Dan Korostelev nadako at gmail.com
Tue Aug 25 08:06:23 EDT 2009


Log message for revision 103198:
  Don't use getResource for IconView url method, instead get the resource like Resource view does.

Changed:
  U   zope.browserresource/trunk/src/zope/browserresource/icon.py

-=-
Modified: zope.browserresource/trunk/src/zope/browserresource/icon.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/icon.py	2009-08-25 11:54:46 UTC (rev 103197)
+++ zope.browserresource/trunk/src/zope/browserresource/icon.py	2009-08-25 12:06:23 UTC (rev 103198)
@@ -15,7 +15,9 @@
 
 $Id$
 """
-from zope.traversing.namespace import getResource
+from zope.component import getAdapter
+from zope.location import locate
+from zope.site.hooks import getSite
 
 class IconView(object):
 
@@ -32,9 +34,8 @@
                 % (self.url(), self.alt, self.width, self.height))
 
     def url(self):
-        # The context is important here, since it becomes the parent of the
-        # icon, which is needed to generate the absolute URL.
-        resource = getResource(self.context, self.rname, self.request)
+        resource = getAdapter(self.request, name=self.rname)
+        locate(resource, getSite(), self.rname)
         return resource()
 
 class IconViewFactory(object):



More information about the Checkins mailing list