本文整理汇总了Python中markupsafe._speedups.escape函数的典型用法代码示例。如果您正苦于以下问题:Python escape函数的具体用法?Python escape怎么用?Python escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escape函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
def login():
""" Login
"""
if request.method == 'POST':
if request.form['username'] and request.form['password']:
import config
if config.USERNAME == escape(request.form['username'])\
and config.PASSWORD == escape(request.form['password']):
session['username'] = escape(request.form['username'])
return redirect(url_for('admin'))
return '''
示例2: escape
def escape(cls, s):
"""Escape the string. Works like :func:`escape` with the difference
that for subclasses of :class:`Markup` this function would return the
correct subclass.
"""
rv = escape(s)
if rv.__class__ is not cls:
return cls(rv)
return rv
示例3: _escape_argspec
def _escape_argspec(obj, iterable):
"""Helper for various string-wrapped functions."""
for key, value in iterable:
if hasattr(value, '__html__') or isinstance(value, basestring):
obj[key] = escape(value)
return obj
示例4: __radd__
def __radd__(self, other):
if hasattr(other, '__html__') or isinstance(other, basestring):
return self.__class__(unicode(escape(other)) + unicode(self))
return NotImplemented
示例5: rpartition
def rpartition(self, sep):
return tuple(map(self.__class__,
unicode.rpartition(self, escape(sep))))
示例6: partition
def partition(self, sep):
return tuple(map(self.__class__,
str.partition(self, escape(sep))))