quixote/form form.py,1.20,1.21

Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]>
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Update of /home/cvs/quixote/form
In directory hewson:/tmp/cvs-serv20492

Modified Files:
	form.py 
Log Message:
Modify form and widget classes to return htmltext instances.  This is a
backards incompatible change.


Index: form.py
===================================================================
RCS file: /home/cvs/quixote/form/form.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- form.py	4 Oct 2002 22:15:48 -0000	1.20
+++ form.py	14 Oct 2002 23:18:54 -0000	1.21
@@ -10,7 +10,7 @@
 
 from types import StringType
 from quixote import get_session, get_publisher
-from quixote.html import url_quote
+from quixote.html import url_quote, htmltext
 from quixote.form import form_templates
 from quixote.form.widget import FormValueError, Widget, HiddenWidget
 
@@ -21,13 +21,13 @@
         return HiddenWidget.render(self, request)
 
 
-JAVASCRIPT_MARKUP = '''\
+JAVASCRIPT_MARKUP = htmltext('''\
 <script type="text/javascript">
 <!--
 %s
 // -->
 </script>
-'''
+''')
 
 
 class Form:
@@ -171,7 +171,7 @@
                     form_code.append(code)
                     javascript_code[code_id] = ''
             if form_code:
-                return JAVASCRIPT_MARKUP % (''.join(form_code))
+                return JAVASCRIPT_MARKUP % htmltext(''.join(form_code))
         return ''
 
 
@@ -401,7 +401,7 @@
         self.submit_buttons.append(new_widget)
 
     def add_cancel_button (self, caption, url):
-        if not isinstance(url, StringType):
+        if not isinstance(url, (StringType, htmltext)):
             raise TypeError, "url must be a string (got %r)" % url
         self.add_submit_button("cancel", caption)
         self.cancel_url = url
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.