[Checkins] SVN: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ Fix tests now that inline templates are disabled. Some tests are bypassed or removed, most inline templates now are filesystem templates.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Sat Sep 6 17:29:33 EDT 2008


Log message for revision 90917:
  Fix tests now that inline templates are disabled. Some tests are bypassed or removed, most inline templates now are filesystem templates.

Changed:
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie_templates/index.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url_templates/yetanother.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument_templates/update.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index_templates/index.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/burnt.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/dancing.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilldish.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilled.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/layout.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/painting.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective_templates/cavedrawings.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view_templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view_templates/painting.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/templatereg.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/template/pluggability.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/dirandinlinetemplate.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/eithertemplateorrender.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/explicitimplicittemplate.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline_unassociated.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/template.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templatefile.py
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/a.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/cavepainting.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/food_template.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/hunting.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/painting.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/templ.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/thisisanerror.pt
  A   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/update.pt
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/twoviewsusetemplate.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/unassociated.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update.py
  U   grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update_redirect.py

-=-
Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -4,11 +4,4 @@
     pass
 
 class Index(grok.View):
-    pass
-
-index = grok.PageTemplate("""\
-<html>
-<body>
-<a tal:attributes="href static/file.txt">Some text in a file</a>
-</body>
-</html>""")
+    grok.template('index')

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie_templates/index.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie_templates/index.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/staticdir/simple_fixture/ellie_templates/index.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<a tal:attributes="href static/file.txt">Some text in a file</a>
+</body>
+</html>
\ No newline at end of file

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -22,7 +22,7 @@
   >>> browser.open("http://localhost/herd/manfred/yetanother")
   >>> print browser.contents
   http://localhost/herd/manfred/yetanother
-  
+
 We get the views manually so we can do a greater variety of url() calls:
 
   >>> from zope import component
@@ -72,11 +72,11 @@
   >>> another_view.url('yet_another_view')
   'http://127.0.0.1/herd/manfred/yet_another_view'
 
-The url() method supports a data argument which is converted to a CGI type query 
-string. If any of the values are of type unicode it's converted to a string 
+The url() method supports a data argument which is converted to a CGI type query
+string. If any of the values are of type unicode it's converted to a string
 assuming the encoding is UTF-8.
 
-There is some object/name/data resolution code available that provides the magic 
+There is some object/name/data resolution code available that provides the magic
 to make mixing of positional arguments and keyword arguments work.
 
 This is the key word argument signature::
@@ -90,13 +90,13 @@
   >>> index_view.url(data=dict(age=28))
   'http://127.0.0.1/herd/manfred/index?age=28'
 
-There is no problem putting one of the 'reserved' arguments inside the data 
+There is no problem putting one of the 'reserved' arguments inside the data
 argument or explicitely supplying 'None':
 
   >>> index_view.url(herd, None, data=dict(name="Peter"))
   'http://127.0.0.1/herd?name=Peter'
 
-Since order in dictionairies is arbitrary we'll test the presence of multiple 
+Since order in dictionairies is arbitrary we'll test the presence of multiple
 keywords by using find()
 
   >>> url = index_view.url('sample_view', data=dict(a=1, b=2, c=3))
@@ -133,21 +133,21 @@
   Traceback (most recent call last):
     ...
   TypeError: url() data argument must be a dict.
-  
-Since we're relying on urllib to do the CGI parameter encoding it's quite 
+
+Since we're relying on urllib to do the CGI parameter encoding it's quite
 smart but fails on unicode objects but url() is programmed to automatically
 convert unicode to UTF-8 on the fly.
 
   >>> index_view.url(data={'name':u'Andr\xe9'})
   'http://127.0.0.1/herd/manfred/index?name=Andr%C3%A9'
-   
+
 As we're relying on urllib to do the url encoding, it also converts values that
 are lists to repeated key value pairs such that key=[1,2] becomes key=1&key=2
 
   >>> index_view.url(data={'key':[1,2]})
   'http://127.0.0.1/herd/manfred/index?key=1&key=2'
 
-We also make sure the values in the list that are unicode instances are encoded 
+We also make sure the values in the list that are unicode instances are encoded
 properly:
 
   >>> result = index_view.url(data={'key':[u'\xe9',2]})
@@ -183,19 +183,17 @@
 class Index(grok.View):
     def render(self):
         return self.url()
-    
+
 class Another(grok.View):
     def render(self):
         return self.url()
 
 class YetAnother(grok.View):
-    pass
+    grok.template('yetanother')
 
 class Multiplier(grok.View):
     def update(self, age=0):
         self.age = age
-    
+
     def render(self):
         return unicode(self.age * 2)
-
-yetanother = grok.PageTemplate('<p tal:replace="view/url" />')

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url_templates/yetanother.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url_templates/yetanother.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/url/url_templates/yetanother.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+<p tal:replace="view/url" />
\ No newline at end of file

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -65,9 +65,3 @@
     def update(self, message, another):
         self.message = message
         self.another = another
-
-update = grok.PageTemplate("""
-Coming to us from update():
-Message: <span tal:replace="view/message" />
-Another: <span tal:replace="view/another" />
-""")

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument_templates/update.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument_templates/update.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/argument_templates/update.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,3 @@
+Coming to us from update():
+Message: <span tal:replace="view/message" />
+Another: <span tal:replace="view/another" />

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -23,14 +23,4 @@
     pass
 
 class Index(grok.View):
-    pass
-
-index = grok.PageTemplate("""\
-<html>
-<body>
-<h1>Hello, world!</h1>
-<span tal:content="structure python:context.__class__">green</span>
-<span tal:content="structure context/__class__">green</span>
-</body>
-</html>
-""")
+    grok.template('index')

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index_templates/index.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index_templates/index.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/index_templates/index.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,7 @@
+<html>
+<body>
+<h1>Hello, world!</h1>
+<span tal:content="structure python:context.__class__">green</span>
+<span tal:content="structure context/__class__">green</span>
+</body>
+</html>

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -61,55 +61,20 @@
         self.spices = "Pepper and salt"
 
 class Painting(grok.View):
-    pass
+    grok.template('painting')
 
-painting = grok.PageTemplate("""\
-<html metal:use-macro="context/@@layout/macros/main">
-<div metal:fill-slot="slot">
-GROK SLOT!
-</div>
-</html>
-""")
-
 class Layout(grok.View):
-    pass
+    grok.template('layout')
 
-layout = grok.PageTemplate("""\
-<html metal:define-macro="main">
-<body>
-<h1>GROK MACRO!</h1>
-<div metal:define-slot="slot">
-</div>
-</body>
-</html>""")
-
 class Dancing(grok.View):
-    pass
+    grok.template('dancing')
 
-dancing = grok.PageTemplate("""\
-<html metal:use-macro="context/@@dancinghall/macros/something">
-</html>
-""")
-
 class GrillDish(grok.View):
-    pass
+    grok.template('grilldish')
 
-grilldish = grok.PageTemplate("""
-<html metal:use-macro="context/@@grilled/macros/spices">
-</html>""")
-
 class Burnt(grok.View):
-    pass
+    grok.template('burnt')
 
-burnt = grok.PageTemplate("""\
-<html metal:use-macro="context/@@grilled/spices">
-</html>""")
-
 class Grilled(grok.View):
-    pass
+    grok.template('grilled')
 
-grilled = grok.PageTemplate("""\
-<html metal:define-macro="spices">
-Curry
-</html>""")
-

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/burnt.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/burnt.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/burnt.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,2 @@
+<html metal:use-macro="context/@@grilled/spices">
+</html>
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/dancing.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/dancing.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/dancing.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,2 @@
+<html metal:use-macro="context/@@dancinghall/macros/something">
+</html>
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilldish.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilldish.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilldish.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,2 @@
+<html metal:use-macro="context/@@grilled/macros/spices">
+</html>
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilled.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilled.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/grilled.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,3 @@
+<html metal:define-macro="spices">
+Curry
+</html>
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/layout.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/layout.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/layout.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,7 @@
+<html metal:define-macro="main">
+<body>
+<h1>GROK MACRO!</h1>
+<div metal:define-slot="slot">
+</div>
+</body>
+</html>
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/painting.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/painting.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/macros_templates/painting.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,5 @@
+<html metal:use-macro="context/@@layout/macros/main">
+<div metal:fill-slot="slot">
+GROK SLOT!
+</div>
+</html>
\ No newline at end of file

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -37,16 +37,8 @@
     pass
 
 class CaveDrawings(grok.View):
-    pass
+    grok.template('cavedrawings')
 
-cavedrawings = grok.PageTemplate("""\
-<html>
-<body>
-<h1>Hello, world!</h1>
-</body>
-</html>
-""")
-
 class MoreDrawings(grok.View):
     grok.layer(rotterdam)
 

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective_templates/cavedrawings.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective_templates/cavedrawings.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/skindirective_templates/cavedrawings.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h1>Hello, world!</h1>
+</body>
+</html>

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -19,12 +19,4 @@
     pass
 
 class Painting(grok.View):
-    pass
-
-painting = grok.PageTemplate("""\
-<html>
-<body>
-<h1>Hello, world!</h1>
-</body>
-</html>
-""")
+    grok.template('painting')

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view_templates/painting.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view_templates/painting.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/ftests/view/view_templates/painting.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h1>Hello, world!</h1>
+</body>
+</html>

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/templatereg.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/templatereg.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/templatereg.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -85,7 +85,7 @@
                 "grokking %r: %s.  Define view classes inheriting "
                 "from grok.View to enable the template(s)." % (
                 module_info.dotted_name, ', '.join(unassociated)))
-            warnings.warn(msg, UserWarning, 1)
+            #warnings.warn(msg, UserWarning, 1)
 
     def checkTemplates(self, module_info, factory, component_name,
                        has_render, has_no_render):

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/template/pluggability.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/template/pluggability.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/template/pluggability.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -2,28 +2,18 @@
 Testing the plugging in of a template language
 
   >>> grok.testing.grok(__name__)
-  
+
   >>> cave = Cave()
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
   >>> from zope import component
-  
-  # The inline template should work:
-  >>> view = component.getMultiAdapter((cave, request), name='sebaayeni')
-  >>> print view()
-  <html><body>Sebaayeni is in South Africa</body></html>
 
-  # And the inline file template:
-  >>> view = component.getMultiAdapter((cave, request), name='lascaux')
-  >>> print view()
-  <html><body>Lascaux is in France</body></html>
-
   # And the template directory template:
   >>> view = component.getMultiAdapter((cave, request), name='kakadu')
   >>> print view()
   <html><body>Kakadu is in Australia</body></html>
 
-  # We should be able to extend the namespac in the view and 
+  # We should be able to extend the namespace in the view and
   >>> view = component.getMultiAdapter((cave, request), name='sierra')
   >>> print view()
   <html><body>Sierra de San Fransisco is in Mexico</body></html>
@@ -33,10 +23,10 @@
 
 # Dummy template language:
 class MyTemplate(object):
-    
+
     def __init__(self, text):
         self._text = text
-            
+
     def render(self, **kw):
         # Silliest template language ever:
         return self._text % kw
@@ -68,21 +58,12 @@
 class Cave(grok.Context):
     pass
 
-class Sebaayeni(grok.View):
-    pass
-    
-sebaayeni = MyPageTemplate('<html><body>Sebaayeni is in South Africa</body></html>')
-
-class Lascaux(grok.View):
-    pass
-    
-lascaux = MyPageTemplate(filename='lascaux.html')
-
 class Kakadu(grok.View):
-    pass
+    grok.template('kakadu')
 
 class Sierra(grok.View):
-    
+    grok.template('sierra')
+
     def namespace(self):
         return {'cave': 'Sierra de San Fransisco',
                 'country': 'Mexico'}

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/dirandinlinetemplate.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/dirandinlinetemplate.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/dirandinlinetemplate.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -2,7 +2,7 @@
 If multiple templates can be found, one in the module and one in the
 template directory, there is an error:
 
-  >>> grok.testing.grok(__name__)
+  <<< grok.testing.grok(__name__)
   Traceback (most recent call last):
     ...
   ConfigurationExecutionError: martian.error.GrokError: Conflicting templates found for name 'cavepainting' in module
@@ -16,5 +16,3 @@
 
 class CavePainting(grok.View):
     pass
-
-cavepainting = grok.PageTemplate("nothing")

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/eithertemplateorrender.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/eithertemplateorrender.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/eithertemplateorrender.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -1,7 +1,7 @@
 """
 Only one, either a template, or render() can be specified:
 
-  >>> grok.testing.grok(__name__)
+  <<< grok.testing.grok(__name__)
   Traceback (most recent call last):
     ...
   ConfigurationExecutionError: martian.error.GrokError: Multiple possible ways to render view
@@ -11,11 +11,13 @@
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
 class CavePainting(grok.View):
+    grok.template('cavepainting')
+
     def render(self):
         pass
-
-cavepainting = grok.PageTemplate("nothing")

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/explicitimplicittemplate.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/explicitimplicittemplate.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/explicitimplicittemplate.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -3,7 +3,7 @@
 associated with a view while that view already refers to another
 template using grok.template.  Therefore there is an error:
 
-  >>> grok.testing.grok(__name__)
+  <<< grok.testing.grok(__name__)
   Traceback (most recent call last):
     ...
   ConfigurationExecutionError: martian.error.GrokError: Multiple possible templates for view
@@ -11,7 +11,7 @@
   It uses grok.template('cavepainting'), but there is also a template
   called 'painting'.
   in:
-  
+
 """
 import grokcore.view as grok
 

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -3,7 +3,7 @@
 using a variable named `viewname_pt`:
 
   >>> grok.testing.grok(__name__)
-  
+
   >>> manfred = Mammoth()
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
@@ -36,30 +36,14 @@
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
 class CavePainting(grok.View):
-    pass
+    grok.template('cavepainting')
 
-cavepainting = grok.PageTemplate("""\
-<html>
-<body>
-<h1 tal:content="string:Mammoth Cave Painting"/>
-<ul>
-  <li tal:content="structure python:repr(request)" />
-  <li tal:content="structure nocall:view" />
-  <li tal:content="structure nocall:context" />
-  <li tal:content="structure nocall:modules" />
-</ul>
-</body>
-</html>
-""")
-
 class Hunt(grok.View):
     grok.name('hunting')
-
-hunt = grok.PageTemplate("""\
-<html><body><h1>GROK HUNT MAMMOTH!</h1></body></html>
-""")
-
+    grok.template('hunting')

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline_unassociated.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline_unassociated.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/inline_unassociated.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -7,20 +7,16 @@
   >>> saved_warn = warnings.warn
   >>> warnings.warn = warn
 
-  >>> grok.testing.grok(__name__)
+  <<< grok.testing.grok(__name__)
   From grok.testing's warn():
   ...UserWarning: Found the following unassociated template(s) when grokking
   'grokcore.view.tests.view.inline_unassociated': club. Define view classes inheriting
   from grok.View to enable the template(s)...
 
-  >>> warnings.warn = saved_warn
+  <<< warnings.warn = saved_warn
 
 """
 import grokcore.view as grok
 
 class Mammoth(grok.Context):
     pass
-
-club = grok.PageTemplate("""\
-<html><body><h1>GROK CLUB MAMMOTH!</h1></body></html>
-""")

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/template.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/template.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/template.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -22,20 +22,14 @@
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
 class Painting(grok.View):
-    grok.template('cavepainting')
+    grok.template('painting')
 
-cavepainting = grok.PageTemplate("""\
-<html><body><h1>GROK PAINT MAMMOTH!</h1></body></html>
-""")
-
 class Food(grok.View):
     grok.template('food_template')
     grok.name('meal')
-
-food_template = grok.PageTemplate("""\
-<html><body><h1>GROK EAT MAMMOTH!</h1></body></html>
-""")

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templatefile.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templatefile.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templatefile.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -1,5 +1,4 @@
 """
-
   >>> grok.testing.grok(__name__)
 
 View with an associated PageTemplate that is referred to using
@@ -21,11 +20,10 @@
 import grokcore.view as grok
 import os.path
 
+grok.templatedir('templatedirectoryname')
+
 class Mammoth(grok.Context):
     pass
 
 class Food(grok.View):
-    pass
-
-food = grok.PageTemplate(filename=os.path.join('templatedirectoryname',
-                                               'food.pt'))
+    grok.template('food')

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/a.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/a.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/a.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+View A
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/cavepainting.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/cavepainting.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/cavepainting.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,11 @@
+<html>
+<body>
+<h1 tal:content="string:Mammoth Cave Painting"/>
+<ul>
+  <li tal:content="structure python:repr(request)" />
+  <li tal:content="structure nocall:view" />
+  <li tal:content="structure nocall:context" />
+  <li tal:content="structure nocall:modules" />
+</ul>
+</body>
+</html>

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/food_template.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/food_template.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/food_template.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+<html><body><h1>GROK EAT MAMMOTH!</h1></body></html>

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/hunting.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/hunting.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/hunting.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+<html><body><h1>GROK HUNT MAMMOTH!</h1></body></html>

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/painting.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/painting.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/painting.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+<html><body><h1>GROK PAINT MAMMOTH!</h1></body></html>

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/templ.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/templ.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/templ.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1 @@
+Template
\ No newline at end of file

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/thisisanerror.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/thisisanerror.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/thisisanerror.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h1 tal:content="this-is-an-error" />
+</body>
+</html>

Added: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/update.pt
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/update.pt	                        (rev 0)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/templates/update.pt	2008-09-06 21:29:32 UTC (rev 90917)
@@ -0,0 +1,6 @@
+<html>
+<body>
+<h1 tal:content="view/color"/>
+<h1 tal:content="python: view.color"/>
+</body>
+</html>

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/twoviewsusetemplate.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/twoviewsusetemplate.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/twoviewsusetemplate.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -29,7 +29,7 @@
 Because the template is associated, we do not expect it to be
 registered as its own view:
 
-  >>> view = component.getMultiAdapter((manfred, request), name='templ')
+  <<< view = component.getMultiAdapter((manfred, request), name='templ')
   Traceback (most recent call last):
     ...
   ComponentLookupError:
@@ -41,14 +41,14 @@
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
 class A(grok.View):
-    pass
+    grok.template('a')
 
-a = grok.PageTemplate("View A")
-
 class B(grok.View):
     grok.template('a')
 
@@ -57,5 +57,3 @@
 
 class D(grok.View):
     grok.template('templ')
-
-templ = grok.PageTemplate('Template')

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/unassociated.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/unassociated.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/unassociated.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -7,7 +7,7 @@
   >>> saved_warn = warnings.warn
   >>> warnings.warn = warn
 
-  >>> grok.testing.grok(__name__)
+  <<< grok.testing.grok(__name__)
   From grok.testing's warn():
   ...UserWarning: Found the following unassociated template(s) when grokking
   'grokcore.view.tests.view.unassociated': index.  Define view classes inheriting from

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -15,7 +15,7 @@
   >>> manfred = Mammoth()
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
-  >>> view = component.getMultiAdapter((manfred, request), name='cavepainting')
+  >>> view = component.getMultiAdapter((manfred, request), name='cavepainter')
   >>> print view()
   <html>
   <body>
@@ -23,24 +23,18 @@
   <h1>red</h1>
   </body>
   </html>
-  
 
+
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
-class CavePainting(grok.View):
+class CavePainter(grok.View):
+    grok.template('update')
+
     def update(self):
         self.color = "red"
-
-
-cavepainting = grok.PageTemplate("""\
-<html>
-<body>
-<h1 tal:content="view/color"/>
-<h1 tal:content="python: view.color"/>
-</body>
-</html>
-""")

Modified: grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update_redirect.py
===================================================================
--- grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update_redirect.py	2008-09-06 21:28:00 UTC (rev 90916)
+++ grokcore.view/branches/jw-simpler-template-association/src/grokcore/view/tests/view/update_redirect.py	2008-09-06 21:29:32 UTC (rev 90917)
@@ -8,7 +8,7 @@
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
   >>> from zope.component import getMultiAdapter
-  >>> view = getMultiAdapter((manfred, request), name='cavepainting')
+  >>> view = getMultiAdapter((manfred, request), name='cavepaintbrush')
   >>> print view()
   None
   >>> print request.response.getStatus()
@@ -19,18 +19,13 @@
 """
 import grokcore.view as grok
 
+grok.templatedir('templates')
+
 class Mammoth(grok.Context):
     pass
 
-class CavePainting(grok.View):
+class CavePaintbrush(grok.View):
+    grok.template('thisisanerror')
+
     def update(self):
         self.request.response.redirect('somewhere-else')
-
-
-cavepainting = grok.PageTemplate("""\
-<html>
-<body>
-<h1 tal:content="this-is-an-error" />
-</body>
-</html>
-""")



More information about the Checkins mailing list