[Checkins] SVN: grokcore.viewlet/trunk/ Update how the static resources are found.

Sylvain Viollow cvs-admin at zope.org
Sun Apr 29 12:53:25 UTC 2012


Log message for revision 125377:
  Update how the static resources are found.
  

Changed:
  U   grokcore.viewlet/trunk/CHANGES.txt
  U   grokcore.viewlet/trunk/src/grokcore/viewlet/components.py

-=-
Modified: grokcore.viewlet/trunk/CHANGES.txt
===================================================================
--- grokcore.viewlet/trunk/CHANGES.txt	2012-04-29 12:52:51 UTC (rev 125376)
+++ grokcore.viewlet/trunk/CHANGES.txt	2012-04-29 12:53:22 UTC (rev 125377)
@@ -4,7 +4,9 @@
 1.10 (unreleased)
 -----------------
 
-- Nothing changed yet.
+- Update how the static resources are found on a ``ViewletManager``
+  and a ``Viewlet``, following the new name ``__static_name__`` set by
+  the template association.
 
 
 1.9 (2011-06-28)

Modified: grokcore.viewlet/trunk/src/grokcore/viewlet/components.py
===================================================================
--- grokcore.viewlet/trunk/src/grokcore/viewlet/components.py	2012-04-29 12:52:51 UTC (rev 125376)
+++ grokcore.viewlet/trunk/src/grokcore/viewlet/components.py	2012-04-29 12:53:22 UTC (rev 125377)
@@ -31,11 +31,14 @@
         self.request = request
         self.view = view
         self.__name__ = self.__view_name__
-        self.static = component.queryAdapter(
-            self.request,
-            interface.Interface,
-            name=self.module_info.package_dotted_name,
-            )
+        static_name = getattr(self, '__static_name__', None)
+        if static_name is not None:
+            self.static = component.queryAdapter(
+                self.request,
+                interface.Interface,
+                name=static_name)
+        else:
+            self.static = None
 
     def sort(self, viewlets):
         """Sort the viewlets.
@@ -99,11 +102,14 @@
         self.view = view
         self.viewletmanager = manager
         self.__name__ = self.__view_name__
-        self.static = component.queryAdapter(
-            self.request,
-            interface.Interface,
-            name=self.module_info.package_dotted_name,
-            )
+        static_name = getattr(self, '__static_name__', None)
+        if static_name is not None:
+            self.static = component.queryAdapter(
+                self.request,
+                interface.Interface,
+                name=static_name)
+        else:
+            self.static = None
 
     def default_namespace(self):
         namespace = {}



More information about the checkins mailing list