当前位置: 首页>>代码示例>>Python>>正文


Python input.HTML类代码示例

本文整理汇总了Python中genshi.input.HTML的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fill_input_password_disabled

 def test_fill_input_password_disabled(self):
     html = HTML("""<form><p>
       <input type="password" name="pass" />
     </p></form>""") | HTMLFormFiller(data={'pass': 'bar'})
     self.assertEquals("""<form><p>
       <input type="password" name="pass"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例2: test_fill_input_hidden_no_value

 def test_fill_input_hidden_no_value(self):
     html = HTML("""<form><p>
       <input type="hidden" name="foo" />
     </p></form>""") | HTMLFormFiller()
     self.assertEquals("""<form><p>
       <input type="hidden" name="foo"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例3: test_fill_input_password_enabled

 def test_fill_input_password_enabled(self):
     html = HTML("""<form><p>
       <input type="password" name="pass" />
     </p></form>""") | HTMLFormFiller(data={'pass': '1234'}, passwords=True)
     self.assertEquals("""<form><p>
       <input type="password" name="pass" value="1234"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例4: test_fill_textarea_no_value

 def test_fill_textarea_no_value(self):
     html = HTML("""<form><p>
       <textarea name="foo"></textarea>
     </p></form>""") | HTMLFormFiller()
     self.assertEquals("""<form><p>
       <textarea name="foo"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例5: test_fill_input_checkbox_single_value_auto_no_value

 def test_fill_input_checkbox_single_value_auto_no_value(self):
     html = HTML("""<form><p>
       <input type="checkbox" name="foo" />
     </p></form>""") | HTMLFormFiller()
     self.assertEquals("""<form><p>
       <input type="checkbox" name="foo"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例6: test_fill_input_hidden_multi_value

 def test_fill_input_hidden_multi_value(self):
     html = HTML("""<form><p>
       <input type="hidden" name="foo" />
     </p></form>""") | HTMLFormFiller(data={'foo': ['bar']})
     self.assertEquals("""<form><p>
       <input type="hidden" name="foo" value="bar"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例7: test_fill_textarea_multi_value

 def test_fill_textarea_multi_value(self):
     html = HTML("""<form><p>
       <textarea name="foo"></textarea>
     </p></form>""") | HTMLFormFiller(data={'foo': ['bar']})
     self.assertEquals("""<form><p>
       <textarea name="foo">bar</textarea>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例8: test_fill_input_text_single_value

 def test_fill_input_text_single_value(self):
     html = HTML("""<form><p>
       <input type="text" name="foo" />
     </p></form>""") | HTMLFormFiller(data={'foo': 'bar'})
     self.assertEquals("""<form><p>
       <input type="text" name="foo" value="bar"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:7,代码来源:test_html.py

示例9: test_fill_textarea_preserve_original

 def test_fill_textarea_preserve_original(self):
     html = HTML("""<form><p>
       <textarea name="foo"></textarea>
       <textarea name="bar">Original value</textarea>
     </p></form>""") | HTMLFormFiller(data={'foo': 'Some text'})
     self.assertEquals("""<form><p>
       <textarea name="foo">Some text</textarea>
       <textarea name="bar">Original value</textarea>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:9,代码来源:test_html.py

示例10: test_fill_textarea_multiple

 def test_fill_textarea_multiple(self):
     # Ensure that the subsequent textarea doesn't get the data from the
     # first
     html = HTML("""<form><p>
       <textarea name="foo"></textarea>
       <textarea name="bar"></textarea>
     </p></form>""") | HTMLFormFiller(data={'foo': 'Some text'})
     self.assertEquals("""<form><p>
       <textarea name="foo">Some text</textarea>
       <textarea name="bar"/>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:11,代码来源:test_html.py

示例11: test_translate_included_attribute_text

 def test_translate_included_attribute_text(self):
     """
     Verify that translated attributes end up in a proper `Attrs` instance.
     """
     html = HTML("""<html>
       <span title="Foo"></span>
     </html>""")
     translator = Translator(lambda s: u"Voh")
     stream = list(html.filter(translator))
     kind, data, pos = stream[2]
     assert isinstance(data[1], Attrs)
开发者ID:alon,项目名称:polinax,代码行数:11,代码来源:i18n.py

示例12: test_fill_option_unicode_value

 def test_fill_option_unicode_value(self):
     html = HTML("""<form>
       <select name="foo">
         <option value="&ouml;">foo</option>
       </select>
     </form>""") | HTMLFormFiller(data={'foo': 'ö'})
     self.assertEquals("""<form>
       <select name="foo">
         <option value="ö" selected="selected">foo</option>
       </select>
     </form>""", html.render(encoding=None))
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:11,代码来源:test_html.py

示例13: save

    def save(self, encoding=None):
        """validate incoming html using genshi's HTMLSanitizer, throw an error if invalid (ie: anything changed in input)"""

        # let creole content go through unverified, the parser will clean it up anyway
        if self.blob.markup_language == 'ductus-html5':
            html = HTML(self.text)
            #TODO: define our own set of acceptable tags/attributes in settings.py
            friendly_attrs = set(['data-gentics-aloha-repository', 'data-gentics-aloha-object-id', 'data-macro-name', 'data-tags', 'contenteditable'])
            sanitizer = HTMLSanitizer(safe_attrs=HTMLSanitizer.SAFE_ATTRS | friendly_attrs)
            safe_html = html | sanitizer
            if html.render() != safe_html.render():
                raise ValidationError(u'invalid html content')

        return super(Wikitext, self).save(encoding)
开发者ID:antiface,项目名称:ductus,代码行数:14,代码来源:ductmodels.py

示例14: test_fill_select_no_value_auto

 def test_fill_select_no_value_auto(self):
     html = HTML(u"""<form><p>
       <select name="foo">
         <option>1</option>
         <option>2</option>
         <option>3</option>
       </select>
     </p></form>""") | HTMLFormFiller()
     self.assertEquals("""<form><p>
       <select name="foo">
         <option>1</option>
         <option>2</option>
         <option>3</option>
       </select>
     </p></form>""", html.render())
开发者ID:afrog33k,项目名称:tart,代码行数:15,代码来源:test_html.py

示例15: test_fill_select_no_value_defined

 def test_fill_select_no_value_defined(self):
     html = HTML("""<form><p>
       <select name="foo">
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
       </select>
     </p></form>""") | HTMLFormFiller()
     self.assertEquals("""<form><p>
       <select name="foo">
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
       </select>
     </p></form>""", html.render())
开发者ID:292388900,项目名称:OmniMarkupPreviewer,代码行数:15,代码来源:test_html.py


注:本文中的genshi.input.HTML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。