[Repoze-checkins] r1246 - in repoze.bfg/trunk/repoze/bfg: . sampleapp sampleapp/www tests

Chris McDonough chrism at agendaless.com
Tue Jul 8 08:53:41 EDT 2008


Author: Chris McDonough <chrism at agendaless.com>
Date: Tue Jul  8 08:53:40 2008
New Revision: 1246

Log:
Call it TemplateView.


Modified:
   repoze.bfg/trunk/repoze/bfg/sampleapp/app.py
   repoze.bfg/trunk/repoze/bfg/sampleapp/www/blog_view.pt
   repoze.bfg/trunk/repoze/bfg/template.py
   repoze.bfg/trunk/repoze/bfg/tests/test_template.py

Modified: repoze.bfg/trunk/repoze/bfg/sampleapp/app.py
==============================================================================
--- repoze.bfg/trunk/repoze/bfg/sampleapp/app.py	(original)
+++ repoze.bfg/trunk/repoze/bfg/sampleapp/app.py	Tue Jul  8 08:53:40 2008
@@ -1,18 +1,22 @@
-from repoze.bfg.template import BrowserView
+from repoze.bfg.template import TemplateView
 
 from webob import Response
 
-class BlogDefaultView(BrowserView):
+class BlogDefaultView(TemplateView):
     def getInfo(self):
         return {'greeting':'Hello, I\'m the default view',
                 'id':self.context.id}
 
-class BlogWooHooView(BrowserView):
+class BlogWooHooView(TemplateView):
     def getInfo(self):
         return {'greeting':'Woo hoo, I\'m another view' ,
                 'id':self.context.id}
 
-class DefaultView(BrowserView):
+class DefaultView(object):
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        
     def __call__(self):
         return Response('Default page, context is %s' % self.context)
 

Modified: repoze.bfg/trunk/repoze/bfg/sampleapp/www/blog_view.pt
==============================================================================
--- repoze.bfg/trunk/repoze/bfg/sampleapp/www/blog_view.pt	(original)
+++ repoze.bfg/trunk/repoze/bfg/sampleapp/www/blog_view.pt	Tue Jul  8 08:53:40 2008
@@ -1,7 +1,7 @@
 <div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal">
-  <div tal:define="info view.getInfo()">
-    <span tal:content="info.greeting"/> from
-    <span tal:content="info.id"/>
+  <div tal:define="info path: view/getInfo">
+    <span tal:content="path: info/greeting"/> from
+    <span tal:content="path: info/id"/>
   </div>
 </div>

Modified: repoze.bfg/trunk/repoze/bfg/template.py
==============================================================================
--- repoze.bfg/trunk/repoze/bfg/template.py	(original)
+++ repoze.bfg/trunk/repoze/bfg/template.py	Tue Jul  8 08:53:40 2008
@@ -26,7 +26,7 @@
                                         options=kwargs)
         return template        
     
-class BrowserView(object):
+class TemplateView(object):
     classProvides(IViewFactory)
     implements(IView)
 

Modified: repoze.bfg/trunk/repoze/bfg/tests/test_template.py
==============================================================================
--- repoze.bfg/trunk/repoze/bfg/tests/test_template.py	(original)
+++ repoze.bfg/trunk/repoze/bfg/tests/test_template.py	Tue Jul  8 08:53:40 2008
@@ -77,7 +77,7 @@
         self.assertEqual(result.status, '200 OK')
         self.assertEqual(len(result.headerlist), 2)
 
-class BrowserViewTests(unittest.TestCase, Base):
+class TemplateViewTests(unittest.TestCase, Base):
     def setUp(self):
         Base.setUp(self)
 
@@ -85,8 +85,8 @@
         Base.tearDown(self)
 
     def _getTargetClass(self):
-        from repoze.bfg.template import BrowserView
-        return BrowserView
+        from repoze.bfg.template import TemplateView
+        return TemplateView
 
     def _makeOne(self, *arg, **kw):
         klass = self._getTargetClass()


More information about the Repoze-checkins mailing list