Пример #1
0
 def testMakeHiddenInput(self):
     tag = make_hidden_input(foo='bar')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="bar">')
     tag = make_hidden_input(foo=1)
     self.assertEqual(tag, '<input type="hidden" name="foo:int" value="1">')
     # Escaping
     tag = make_hidden_input(foo='bar & baz')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="bar &amp; baz">')
     tag = make_hidden_input(foo='<bar>')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="&lt;bar&gt;">')
     tag = make_hidden_input(foo='"bar"')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="&quot;bar&quot;">')
Пример #2
0
 def testMakeHiddenInput(self):
     tag = make_hidden_input(foo='bar')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="bar">')
     tag = make_hidden_input(foo=1)
     self.assertEqual(tag, '<input type="hidden" name="foo:int" value="1">')
     # Escaping
     tag = make_hidden_input(foo='bar & baz')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="bar &amp; baz">')
     tag = make_hidden_input(foo='<bar>')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="&lt;bar&gt;">')
     tag = make_hidden_input(foo='"bar"')
     self.assertEqual(tag, '<input type="hidden" name="foo" value="&quot;bar&quot;">')
Пример #3
0
 def testMakeHiddenInput(self):
     test_unicode = u'unic\xF3de'
     quote_unicode = test_unicode.encode('utf8')
     tag = make_hidden_input(foo=test_unicode)
     #set 'zpublisher_default_encoding'  to utf8
     self.assertEqual(
         tag, '<input type="hidden" name="foo:utf8:ustring" value="%s">' %
         (quote_unicode, ))
Пример #4
0
 def testMakeHiddenInput(self):
     test_unicode = u'unic\xF3de'
     quote_unicode = test_unicode.encode('utf8')
     tag = make_hidden_input(foo=test_unicode)
     #set 'zpublisher_default_encoding'  to utf8
     self.assertEqual(tag, '<input type="hidden" name="foo:utf8:ustring" value="%s">' % (quote_unicode,))