Use new PTL syntax. (quixote/demo/forms.ptl)

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 26 Nov 2002 18:53:44 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Update of /home/cvs/quixote/demo
In directory hewson:/tmp/cvs-serv7870

Modified Files:
	forms.ptl 
Log Message:
Use new PTL syntax.


Index: forms.ptl
===================================================================
RCS file: /home/cvs/quixote/demo/forms.ptl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- forms.ptl	20 Nov 2002 19:43:22 -0000	1.4
+++ forms.ptl	26 Nov 2002 23:53:42 -0000	1.5
@@ -7,7 +7,6 @@
 
 import time
 from quixote.form.form import Form
-from quixote.html import html_quote
 
 class Topping:
     def __init__(self, name, cost):
@@ -19,7 +18,7 @@
 
     def __repr__ (self):
         return "<%s at %08x: %s>" % (self.__class__.__name__,
-                                     id(self), str(self))
+                                     id(self), self)
 
 
 TOPPINGS = [Topping('cheese', 50),
@@ -54,11 +53,11 @@
                         value=TOPPINGS[0],
                         allowed_values=TOPPINGS,
                         size=5)
-        self.add_widget('hidden', 'time', value=str(time.time()))
+        self.add_widget('hidden', 'time', value=time.time())
         self.add_submit_button("go", "Go!")
 
 
-    template render (self, request, action_url):
+    def render [html] (self, request, action_url):
         """
         <html>
         <head><title>Quixote Form Demo</title></head>
@@ -82,7 +81,7 @@
         return form_data
 
 
-    template action (self, request, submit_button, form_data):
+    def action [html] (self, request, submit_button, form_data):
         # The data has been submitted and verified.  Do something interesting
         # with it (save it in DB, send email, etc.).  We'll just display it.
         """
@@ -100,8 +99,10 @@
         for name, value in form_data.items():
             '<tr>'
             '  <td>%s</td>' % name
-            '  <td>%s</td>' % html_quote(type(value).__name__)
-            '  <td>%s</td>' % html_quote(value, "<i>no value</i>")
+            '  <td>%s</td>' % type(value).__name__
+            if value is None:
+                value = "<i>no value</i>"
+            '  <td>%s</td>' % value
             '</tr>'
         """
         </table>