[Checkins] SVN: grok/trunk/doc/ Second phase of reading url
parameters.
Martijn Faassen
faassen at infrae.com
Sat Mar 17 06:42:04 EDT 2007
Log message for revision 73277:
Second phase of reading url parameters.
Changed:
A grok/trunk/doc/groktut/reading_url_parameters2/
U grok/trunk/doc/groktut/reading_url_parameters2/src/sample/app.py
U grok/trunk/doc/tutorial.txt
-=-
Copied: grok/trunk/doc/groktut/reading_url_parameters2 (from rev 73276, grok/trunk/doc/groktut/reading_url_parameters)
Modified: grok/trunk/doc/groktut/reading_url_parameters2/src/sample/app.py
===================================================================
--- grok/trunk/doc/groktut/reading_url_parameters/src/sample/app.py 2007-03-17 10:40:20 UTC (rev 73276)
+++ grok/trunk/doc/groktut/reading_url_parameters2/src/sample/app.py 2007-03-17 10:42:03 UTC (rev 73277)
@@ -4,5 +4,5 @@
pass
class Index(grok.View):
- def update(self, value1, value2):
+ def update(self, value1=0, value2=0):
self.sum = int(value1) + int(value2)
Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt 2007-03-17 10:40:20 UTC (rev 73276)
+++ grok/trunk/doc/tutorial.txt 2007-03-17 10:42:03 UTC (rev 73277)
@@ -672,17 +672,11 @@
TypeError: Missing argument to update(): value1
-We can modify our code so it works even without input for either parameter::
+We can modify our code so it works even without input for either parameter:
- import grok
+.. include:: groktut/reading_url_parameters2/src/sample/app.py
+ :literal:
- class Sample(grok.Application, grok.Container):
- pass
-
- class Index(grok.View):
- def update(self, value1=0, value2=0):
- self.sum = int(value1) + int(value2)
-
Restart Zope, and see it can now deal with missing parameters (they
default to ``0``).
More information about the Checkins
mailing list