Updated venusian category
authorThierry Florac <thierry.florac@onf.fr>
Wed, 07 Oct 2015 17:42:10 +0200
changeset 4 d9dc2f58c72b
parent 3 67596b00650c
child 5 29fbf87650d4
Updated venusian category
src/pyams_template/template.py
--- a/src/pyams_template/template.py	Wed Jun 17 10:00:55 2015 +0200
+++ b/src/pyams_template/template.py	Wed Oct 07 17:42:10 2015 +0200
@@ -115,7 +115,7 @@
 
 
 class template_config(object):
-    """Class decorator used to declare a template"""
+    """Class decorator used to declare a view template"""
 
     venusian = venusian  # for testing injection
 
@@ -145,7 +145,7 @@
                                             (ob, settings.get('layer', IRequest)),
                                             provides, settings.get('name', ''))
 
-        info = self.venusian.attach(wrapped, callback, category='pyams_pagelet')
+        info = self.venusian.attach(wrapped, callback, category='pyams_template')
 
         if info.scope == 'class':
             # if the decorator was attached to a method in a class, or
@@ -159,7 +159,7 @@
 
 
 class layout_config(object):
-    """Class decorator used to declare a template"""
+    """Class decorator used to declare a layout template"""
 
     venusian = venusian  # for testing injection
 
@@ -173,7 +173,8 @@
         settings = self.__dict__.copy()
 
         def callback(context, name, ob):
-            template = os.path.join(os.path.dirname(inspect.getfile(ob)), settings.get('template'))
+            template = os.path.join(os.path.dirname(inspect.getfile(inspect.getmodule(ob))),
+                                    settings.get('template'))
             if not os.path.isfile(template):
                 raise ConfigurationError("No such file", template)
 
@@ -188,7 +189,7 @@
                                             (ob, settings.get('layer', IRequest)),
                                             provides, settings.get('name', ''))
 
-        info = self.venusian.attach(wrapped, callback, category='pyams_pagelet')
+        info = self.venusian.attach(wrapped, callback, category='pyams_template')
 
         if info.scope == 'class':
             # if the decorator was attached to a method in a class, or