[Checkins] SVN: grok/trunk/doc/groktut/the_rules_of_persistence/
rules of persistence sample code.
Martijn Faassen
faassen at infrae.com
Mon Mar 19 18:28:37 EDT 2007
Log message for revision 73361:
rules of persistence sample code.
Changed:
A grok/trunk/doc/groktut/the_rules_of_persistence/
U grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app.py
U grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/edit.pt
U grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/index.pt
-=-
Copied: grok/trunk/doc/groktut/the_rules_of_persistence (from rev 73359, grok/trunk/doc/groktut/storing_data)
Modified: grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app.py
===================================================================
--- grok/trunk/doc/groktut/storing_data/src/sample/app.py 2007-03-19 21:02:20 UTC (rev 73359)
+++ grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app.py 2007-03-19 22:28:36 UTC (rev 73361)
@@ -1,8 +1,10 @@
import grok
class Sample(grok.Application, grok.Container):
- text = 'default text'
-
+ def __init__(self):
+ super(Sample, self).__init__()
+ self.list = []
+
class Index(grok.View):
pass
@@ -10,4 +12,5 @@
def update(self, text=None):
if text is None:
return
- self.context.text = text
+ self.context.list.append(text)
+ self.redirect(self.url('index'))
Modified: grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/edit.pt
===================================================================
--- grok/trunk/doc/groktut/storing_data/src/sample/app_templates/edit.pt 2007-03-19 21:02:20 UTC (rev 73359)
+++ grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/edit.pt 2007-03-19 22:28:36 UTC (rev 73361)
@@ -5,4 +5,4 @@
<input type="submit" value="Store" />
</form>
</body>
-</html>
+</html>
\ No newline at end of file
Modified: grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/index.pt
===================================================================
--- grok/trunk/doc/groktut/storing_data/src/sample/app_templates/index.pt 2007-03-19 21:02:20 UTC (rev 73359)
+++ grok/trunk/doc/groktut/the_rules_of_persistence/src/sample/app_templates/index.pt 2007-03-19 22:28:36 UTC (rev 73361)
@@ -1,5 +1,9 @@
<html>
<body>
-<p>The text: <span tal:replace="python:context.text">text</span></p>
+We store the following texts:
+<ul>
+ <li tal:repeat="text python:context.list" tal:content="text"></li>
+</ul>
+<a tal:attributes="href python:view.url('edit')">Add a text</a>
</body>
</html>
More information about the Checkins
mailing list