[Checkins] SVN: grok/trunk/doc/ First phase of sample-izing reading url parameters.

Martijn Faassen faassen at infrae.com
Sat Mar 17 06:40:21 EDT 2007


Log message for revision 73276:
  First phase of sample-izing reading url parameters.
  

Changed:
  A   grok/trunk/doc/groktut/reading_url_parameters/
  U   grok/trunk/doc/groktut/reading_url_parameters/src/sample/app.py
  U   grok/trunk/doc/groktut/reading_url_parameters/src/sample/app_templates/index.pt
  U   grok/trunk/doc/tutorial.txt

-=-
Copied: grok/trunk/doc/groktut/reading_url_parameters (from rev 73273, grok/trunk/doc/groktut/doing_some_calculation_before_viewing_a_page)

Modified: grok/trunk/doc/groktut/reading_url_parameters/src/sample/app.py
===================================================================
--- grok/trunk/doc/groktut/doing_some_calculation_before_viewing_a_page/src/sample/app.py	2007-03-17 10:34:08 UTC (rev 73273)
+++ grok/trunk/doc/groktut/reading_url_parameters/src/sample/app.py	2007-03-17 10:40:20 UTC (rev 73276)
@@ -4,6 +4,5 @@
     pass
 
 class Index(grok.View):
-    def update(self):
-        self.alpha = 2 ** 8
-
+    def update(self, value1, value2):
+        self.sum = int(value1) + int(value2)

Modified: grok/trunk/doc/groktut/reading_url_parameters/src/sample/app_templates/index.pt
===================================================================
--- grok/trunk/doc/groktut/doing_some_calculation_before_viewing_a_page/src/sample/app_templates/index.pt	2007-03-17 10:34:08 UTC (rev 73273)
+++ grok/trunk/doc/groktut/reading_url_parameters/src/sample/app_templates/index.pt	2007-03-17 10:40:20 UTC (rev 73276)
@@ -1,5 +1,5 @@
 <html>
 <body>
-<p tal:content="python:view.alpha">Hello world!</p>
+<p tal:content="python:view.sum">sum</p>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt	2007-03-17 10:36:39 UTC (rev 73275)
+++ grok/trunk/doc/tutorial.txt	2007-03-17 10:40:20 UTC (rev 73276)
@@ -644,25 +644,16 @@
 
 you should see the sum (8) as the result on the page. 
 
-Modify ``app.py`` to read like this::
+Modify ``app.py`` to read like this:
 
-  import grok
+.. include:: groktut/reading_url_parameters/src/sample/app.py
+  :literal:
 
-  class Sample(grok.Application, grok.Container):
-      pass
+We need an ``index.pt`` that uses ``sum``:
 
-  class Index(grok.View):
-      def update(self, value1, value2):
-          self.sum = int(value1) + int(value2)
+.. include:: groktut/reading_url_parameters/src/sample/app_templates/index.pt
+  :literal:
 
-We need an ``index.pt`` that uses ``sum``::
-
-  <html>
-  <body>
-  <p tal:content="view/sum"></p>
-  </body>
-  </html>
-
 Restart Zope. Now going to the folllowing URL should display 8:
 
   http://localhost:8080/test?value1=3&value2=5



More information about the Checkins mailing list