[Checkins] SVN: grok/trunk/doc/ Sample-ize another section.

Martijn Faassen faassen at infrae.com
Fri Mar 16 17:12:52 EDT 2007


Log message for revision 73250:
  Sample-ize another section.
  

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

-=-
Modified: grok/trunk/doc/groktut/buildout_tut.cfg
===================================================================
--- grok/trunk/doc/groktut/buildout_tut.cfg	2007-03-16 21:05:20 UTC (rev 73249)
+++ grok/trunk/doc/groktut/buildout_tut.cfg	2007-03-16 21:12:51 UTC (rev 73250)
@@ -4,7 +4,7 @@
 
 [zope3]
 # change this to the path to an installed Zope 3 installation
-location = /path/to/zope331
+location = /home/faassen/buildout/z331
 
 [data]
 recipe = zc.recipe.filestorage

Copied: grok/trunk/doc/groktut/using_view_methods (from rev 73246, grok/trunk/doc/groktut/publishing_a_simple_web_page)

Modified: grok/trunk/doc/groktut/using_view_methods/src/sample/app.py
===================================================================
--- grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/app.py	2007-03-16 20:51:35 UTC (rev 73246)
+++ grok/trunk/doc/groktut/using_view_methods/src/sample/app.py	2007-03-16 21:12:51 UTC (rev 73250)
@@ -1,7 +1,10 @@
 import grok
-  
+from datetime import datetime
+
 class Sample(grok.Application, grok.Container):
     pass
 
-class Index(grok.View):
-    pass
+class Index(grok.View):    
+    def current_datetime(self):
+        now = datetime.now()
+        return now.strftime('%Y-%m-%d %H:%M')

Modified: grok/trunk/doc/groktut/using_view_methods/src/sample/app_templates/index.pt
===================================================================
--- grok/trunk/doc/groktut/publishing_a_simple_web_page/src/sample/app_templates/index.pt	2007-03-16 20:51:35 UTC (rev 73246)
+++ grok/trunk/doc/groktut/using_view_methods/src/sample/app_templates/index.pt	2007-03-16 21:12:51 UTC (rev 73250)
@@ -1,5 +1,5 @@
 <html>
 <body>
-<p>Hello world!</p>
+<p tal:content="python:view.current_datetime()">Hello world!</p>
 </body>
 </html>
\ No newline at end of file

Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt	2007-03-16 21:05:20 UTC (rev 73249)
+++ grok/trunk/doc/tutorial.txt	2007-03-16 21:12:51 UTC (rev 73250)
@@ -426,7 +426,7 @@
 
   If you have followed the tutorial so far, you will have an extra
   template called ``bye.pt`` in your ``app_templates`` directory.
-  Since in the above code sample we have no more class using it, the
+  Since in the given ``app.py``e we have no more class using it, the
   ``bye.pt`` template will have become *unassociated**. When you try
   to restart Zope, grok will be unable to read your application, and
   Zope will crash with an error message like this::
@@ -481,28 +481,17 @@
 That looks better.
 
 So far nothing new; just Python. We will integrate this code into our
-Grok project now. Go to ``app.py`` and change it to read like this::
+Grok project now. Go to ``app.py`` and change it to read like this:
 
-  import grok
-  from datetime import datetime
+.. include:: groktut/using_view_methods/src/sample/app.py
+  :literal:
 
-  class Sample(grok.Application, grok.Container):
-      pass
-
-  class Index(grok.View):    
-      def current_datetime(self):
-          now = datetime.now()
-          return now.strftime('%Y-%m-%d %H:%M')
-
 We've simply added a method to our view that returns a string
 representing the current date and time. Now to get this string in our
-page template. Change ``index.pt`` to read like this::
+page template. Change ``index.pt`` to read like this:
 
-  <html>
-  <body>
-  <p tal:content="python:view.current_datetime()"></p>
-  </body>
-  </html>
+.. include:: groktut/using_view_methods/src/sample/app_templates/index.pt
+  :literal:
 
 Restart Zope. This is needed as we changed the content of a Python
 file (``app.py``). Now reload our index page to see whether it worked:



More information about the Checkins mailing list