[Checkins] SVN: Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/ Update tests.

Uli Fouquet uli at gnufix.de
Sun Feb 22 08:01:06 EST 2009


Log message for revision 97031:
  Update tests.

Changed:
  U   Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/README.txt
  U   Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/tests/cpt_fixture/app.py

-=-
Modified: Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/README.txt
===================================================================
--- Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/README.txt	2009-02-22 12:50:09 UTC (rev 97030)
+++ Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/README.txt	2009-02-22 13:01:06 UTC (rev 97031)
@@ -123,8 +123,29 @@
     </body>
     </html>
 
+Inline Templates
+----------------
 
+We can also define inline templates. In our ``app.py`` we defined an
+inline template like this::
 
+  import grok
+  from megrok.chameleon import components
+
+  ...
+
+  class Inline(grok.View):
+    sometext = 'Some Text'
+
+  inline = components.ChameleonPageTemplate(
+      "<html><body>ME GROK HAS INLINES! ${view.sometext}</body></html>")
+
+If we render this view we get::
+
+    >>> view = getMultiAdapter((manfred, request), name='inline')
+    >>> print view()
+    <html><body>ME GROK HAS INLINES! Some Text</body></html>
+
 Clean up::
 
     >>> del getRootFolder()['manfred']

Modified: Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/tests/cpt_fixture/app.py
===================================================================
--- Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/tests/cpt_fixture/app.py	2009-02-22 12:50:09 UTC (rev 97030)
+++ Sandbox/ulif/megrok.chameleon/src/megrok/chameleon/tests/cpt_fixture/app.py	2009-02-22 13:01:06 UTC (rev 97031)
@@ -25,8 +25,8 @@
     game = "MAMMOTH!"
 
 class Inline(grok.View):
-    pass
+    sometext = 'Some Text'
 
 inline = components.ChameleonPageTemplate(
-    "<html><body>ME GROK HAS INLINES!</body></html>")
+    "<html><body>ME GROK HAS INLINES! ${view.sometext}</body></html>")
 



More information about the Checkins mailing list