[Checkins] SVN: grok/trunk/doc/design/views.py update the design docs according to reality so that it won't confuse

Philipp von Weitershausen philikon at philikon.de
Fri Feb 23 18:01:15 EST 2007


Log message for revision 72795:
  update the design docs according to reality so that it won't confuse
  people straying SVN for docs
  

Changed:
  U   grok/trunk/doc/design/views.py

-=-
Modified: grok/trunk/doc/design/views.py
===================================================================
--- grok/trunk/doc/design/views.py	2007-02-23 22:52:58 UTC (rev 72794)
+++ grok/trunk/doc/design/views.py	2007-02-23 23:01:14 UTC (rev 72795)
@@ -1,6 +1,6 @@
 import grok
 
-grok.resources('calc')  # this is actually the default (from module name, calc.py)
+grok.templatedir('calc_templates')  # this is actually the default (from module name, calc.py)
 
 class Calculator(grok.Model):
     pass
@@ -8,43 +8,35 @@
 class Sum(grok.View):
     """Simple view for a model"""
     grok.context(Calculator)  # this is actually the default (from module)
-    grok.template('sum.html')  # this is actually the default (from class name)
+    grok.template('sum')  # this is actually the default (from class name)
     grok.name('sum')  # this is actually the default (from class name)
-    grok.require('zope.Public')  # this is actually the default   #XXX protect???
+    grok.require('zope.Public')  # this is actually the default
 
     def calculateSum(self):
         """you can pull this in the template through view/calculateSum"""
-    
-    @grok.before
-    def precalculatedSum(self):
+
+    def update(self):    
         """executed before the template is rendered"""
         self.sum = self.calculateSum()
+        self.sendEmail()
 
-    @grok.before
     def sendEmail(self):
         """send an email here"""
 
-    @grok.before
-    def afterSendingAnEmail(self):
-        """this is also executed before the template is rendered, but
-        since it's defined after sendEmail, it's also executed after
-        sendEmail."""
-
 class PDFSum(grok.View):
 
-    @grok.before
-    def dosomething(self):
+    def update(self):
         pass
 
     def render(self):
         return pdfdata
 
-
 sum = grok.PageTemplate("""\
 <p tal:content="view/calculateSum">...</p>
 <p tal:content="view/precalculatedSum">...</p>
 """)
 
+
 from zope import schema
 
 class Index(grok.Form):



More information about the Checkins mailing list