[Checkins] SVN: grok/trunk/src/grok/ be clearer about associated templates

Philipp von Weitershausen philikon at philikon.de
Sun Oct 15 13:17:10 EDT 2006


Log message for revision 70662:
  be clearer about associated templates
  

Changed:
  U   grok/trunk/src/grok/_grok.py
  U   grok/trunk/src/grok/tests/view/inline.py

-=-
Modified: grok/trunk/src/grok/_grok.py
===================================================================
--- grok/trunk/src/grok/_grok.py	2006-10-15 16:58:49 UTC (rev 70661)
+++ grok/trunk/src/grok/_grok.py	2006-10-15 17:17:09 UTC (rev 70662)
@@ -106,7 +106,7 @@
         # find inline templates
         template = templates.get(name)
         if template:
-            templates.markUsed(name)
+            templates.markAssociated(name)
             factory.template = template
         else:
             if not getattr(factory, 'render', None):
@@ -118,13 +118,15 @@
                                  provides=interface.Interface,
                                  name=name)
 
-    for name, unused_template in templates.listUnused():
+    for name, unassociated in templates.listUnassociatedTemplates():
         source = '<%s template in %s>' % (name, dotted_name)
         check_context(source, context)
 
         class TemplateView(View):
-            template = unused_template
+            template = unassociated
 
+        templates.markAssociated(name)
+
         component.provideAdapter(TemplateView,
                                  adapts=(context, IDefaultBrowserLayer),
                                  provides=interface.Interface,
@@ -136,10 +138,10 @@
         self._reg = {}
 
     def register(self, name, template):
-        self._reg[name] = dict(template=template, used=False)
+        self._reg[name] = dict(template=template, associated=False)
 
-    def markUsed(self, name):
-        self._reg[name]['used'] = True
+    def markAssociated(self, name):
+        self._reg[name]['associated'] = True
 
     def get(self, name):
         entry = self._reg.get(name)
@@ -147,9 +149,9 @@
             return None
         return entry['template']
 
-    def listUnused(self):
+    def listUnassociatedTemplates(self):
         for name, entry in self._reg.iteritems():
-            if not entry['used']:
+            if not entry['associated']:
                 yield name, entry['template']
 
 def defined_locally(obj, dotted_name):

Modified: grok/trunk/src/grok/tests/view/inline.py
===================================================================
--- grok/trunk/src/grok/tests/view/inline.py	2006-10-15 16:58:49 UTC (rev 70661)
+++ grok/trunk/src/grok/tests/view/inline.py	2006-10-15 17:17:09 UTC (rev 70662)
@@ -22,6 +22,10 @@
   </body>
   </html>
 
+Note that the CavePainting instance is bound to the ``view`` name in
+the template.  This shows that the association of inline PageTemplate
+and the view class is successful.
+
 Templates that are not associated with a view class will still be
 registered on the model:
 



More information about the Checkins mailing list