[Checkins] SVN: grok/trunk/doc/ Convert another tutorial section to sample app.

Martijn Faassen faassen at infrae.com
Sat Mar 17 06:34:08 EDT 2007


Log message for revision 73273:
  Convert another tutorial section to sample app.
  

Changed:
  A   grok/trunk/doc/groktut/doing_some_calculation_before_viewing_a_page/
  U   grok/trunk/doc/tutorial.txt

-=-
Copied: grok/trunk/doc/groktut/doing_some_calculation_before_viewing_a_page (from rev 73272, grok/trunk/doc/groktut/doing_some_calculations_before_viewing_a_page)

Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt	2007-03-17 10:33:00 UTC (rev 73272)
+++ grok/trunk/doc/tutorial.txt	2007-03-17 10:34:08 UTC (rev 73273)
@@ -610,28 +610,19 @@
 calculated once per view, even if you use it multiple times.
 
 You can do this by defining an ``update`` method on the view class. Modify
-``app.py`` to read like this::
+``app.py`` to read like this:
 
-  import grok
+.. include:: groktut/doing_some_calculation_before_viewing_a_page/src/sample/app.py
+  :literal:
 
-  class Sample(grok.Application, grok.Container):
-      pass
-
-  class Index(grok.View):
-      def update(self):
-          self.alpha = 2 ** 8
-
 This sets a name ``alpha`` on the view just before the template is
 being displayed, so we can use it from the template. You can set as
 many names on ``self`` as you like.
 
-Now we need a template ``index.pt`` that uses ``alpha``::
+Now we need a template ``index.pt`` that uses ``alpha``:
 
-  <html>
-  <body>
-  <p tal:content="view/alpha"></p>
-  </body>
-  </html>
+.. include:: groktut/doing_some_calculation_before_viewing_a_page/src/sample/app_templates/index.pt
+  :literal:
 
 Restart Zope and then let's take another look at our application:
 



More information about the Checkins mailing list