本文整理汇总了Python中net.websafe函数的典型用法代码示例。如果您正苦于以下问题:Python websafe函数的具体用法?Python websafe怎么用?Python websafe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了websafe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
def render(self):
x = '<input type="password" name="%s"' % net.websafe(self.name)
if self.value: x += ' value="%s"' % net.websafe(self.value)
x += self.addatts()
x += ' />'
x += self.rendernote(self.note)
return x
示例2: render
def render(self):
x = '<textarea name="%s"' % net.websafe(self.name)
x += self.addatts()
x += '>'
if self.value is not None: x += net.websafe(self.value)
x += '</textarea>'
return x
示例3: render
def render(self):
attrs = self.attrs.copy()
attrs['name'] = self.name
attrs['type'] = net.websafe(self.type)
if self.value is not None:
attrs['value'] = self.value
html = attrs.pop('html', None) or net.websafe(self.name)
return '<button %s>%s</button>' % (attrs, html)
示例4: render
def render(self):
x = '<textarea name="%s"' % net.websafe(self.name)
x += self.addatts()
x += '>'
if self.value is not None: x += net.websafe(self.value).decode('utf-8')
x += '</textarea>'
x = self.rendernote(self.note) + x
return x
示例5: render
def render(self):
x = '<select name="%s"%s>\n' % (net.websafe(self.name), self.addatts())
for arg in self.args:
if self.value == arg: select_p = ' selected="selected"'
else: select_p = ''
x += " <option"+select_p+">%s</option>\n" % net.websafe(arg)
x += '</select>\n'
return x
示例6: render
def render(self):
attrs = self.attrs.copy()
attrs["name"] = self.name
if self.value is not None:
attrs["value"] = self.value
html = attrs.pop("html", None) or net.websafe(self.name)
return "<button %s>%s</button>" % (attrs, html)
示例7: render_css
def render_css(self):
out = []
out.append(self.rendernote(self.note))
for i in self.inputs:
out.append('<label for="%s">%s</label>' % (i.id, net.websafe(i.description)))
out.append(i.pre)
out.append(i.render())
out.append(i.post)
out.append('\n')
return ''.join(out)
示例8: _render_option
def _render_option(self, arg, indent=' '):
if isinstance(arg, (tuple, list)):
value, desc= arg
else:
value, desc = arg, arg
if self.value == value or (isinstance(self.value, list) and value in self.value):
select_p = ' selected="selected"'
else:
select_p = ''
return indent + '<option%s value="%s">%s</option>\n' % (select_p, net.websafe(value), net.websafe(desc))
示例9: render_css
def render_css(self):
out = []
out.append(self.rendernote(self.note))
for i in self.inputs:
if not i.is_hidden():
out.append('<label for="%s">%s</label>' % (i.id, net.websafe(i.description)))
out.append(i.pre)
out.append(i.render())
out.append(self.rendernote(i.note))
out.append(i.post)
out.append("\n")
return "".join(out)
示例10: render
def render(self):
out = ''
out += self.rendernote(self.note)
# out += '<table>\n'
for i in self.inputs:
html = utils.safeunicode(i.pre) + i.render() + self.rendernote(i.note) + utils.safeunicode(i.post)
if i.is_hidden():
out += ' <div style="display: none;">%s</div>\n' % (html)
else:
out += ' <label for="%s">%s</label>%s\n' % (i.id, net.websafe(i.description), html)
# out += "</table>"
return out
示例11: render_css
def render_css(self):
out = []
out.append(self.rendernote(self.note))
for i in self.inputs:
out.append('<div class="row">')
if not i.is_hidden():
out.append('<label for="%s">%s</label>' % (i.id, net.websafe(i.description)))
out.append(i.pre)
out.append(i.render())
out.append(self.rendernote(i.note))
out.append(i.post)
out.append('</div>')
out.append('\n')
return ''.join(out)
示例12: render
def render(self):
x = '<span>'
for arg in self.args:
if isinstance(arg, (tuple, list)):
value, desc= arg
else:
value, desc = arg, arg
attrs = self.attrs.copy()
attrs['name'] = self.name
attrs['type'] = 'radio'
attrs['value'] = arg
if self.value == arg:
attrs['checked'] = 'checked'
x += '<input %s/> %s' % (attrs, net.websafe(desc))
x += '</span>'
return x
示例13: render
def render(self):
out = ""
out += self.rendernote(self.note)
out += "<table>\n"
for i in self.inputs:
html = i.pre + i.render() + self.rendernote(i.note) + i.post
if i.is_hidden():
out += ' <tr style="display: none;"><th></th><td>%s</td></tr>\n' % (html)
else:
out += ' <tr><th><label for="%s">%s</label></th><td>%s</td></tr>\n' % (
i.id,
net.websafe(i.description),
html,
)
out += "</table>"
return out
示例14: render
def render(self):
out = ''
out += self.rendernote(self.note)
out += '<table class="formtab table table-bordered">\n'
out += '<thead ><tr class=active><th>%s</th><th class=rtd><a class="btn"\
href="javascript:history.go(-1);">%s</a></th></tr></thead>\n'%(self.title, net.websafe("返回"))
for i in self.inputs:
html = safeunicode(i.pre) + i.render() + self.rendernote(i.note) + safeunicode(i.post)
if i.is_hidden():
out += ' <tr style="display: none;"><td></td><td>%s</td></tr>\n' % (html)
else:
out += ' <tr><td>%s</td><td>%s</td></tr>\n' % ( net.websafe(i.description),html)
if self.error:
out += ' <tr><td colspan=2>%s</td></tr>\n' % ( self.rendernote(self.error))
out += "</table>"
return out
示例15: rendernote
def rendernote(self, note):
if note: return '<span class="error">%s</span>' % net.websafe(note)
else: return ""