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


Python html.xmlescape方法代码示例

本文整理汇总了Python中gluon.html.xmlescape方法的典型用法代码示例。如果您正苦于以下问题:Python html.xmlescape方法的具体用法?Python html.xmlescape怎么用?Python html.xmlescape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gluon.html的用法示例。


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

示例1: download

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def download(current, upload_id, filename=None):
    db = current.db
    response = current.response
    if filename is None:
        filename = "download_" + upload_id

    row = db(db.uploads.id == upload_id).select().first()
    if row:
        response.headers[blobstore.BLOB_KEY_HEADER] = row.blob_key
        response.headers["Content-Type"] = "application/octet-stream"
        response.headers["Content-Disposition"] = (
            'attachment; filename="%s"' % html.xmlescape(filename))

        audit.log(current, "FileDownload", upload_id=upload_id)

    else:
        raise ValueError("not found") 
开发者ID:rekall-innovations,项目名称:rekall-agent-server,代码行数:19,代码来源:uploads.py

示例2: write

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def write(self, data, escape=True):
        if not escape:
            self.body.write(str(data))
        else:
            self.body.write(to_native(xmlescape(data))) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:7,代码来源:globals.py

示例3: include_meta

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def include_meta(self):
        s = "\n"
        for meta in iteritems((self.meta or {})):
            k, v = meta
            if isinstance(v, dict):
                s += '<meta' + ''.join(' %s="%s"' % (xmlescape(key),
                                                     to_native(xmlescape(v[key]))) for key in v) + ' />\n'
            else:
                s += '<meta name="%s" content="%s" />\n' % (k, to_native(xmlescape(v)))
        self.write(s, escape=False) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:12,代码来源:globals.py

示例4: xml_rec

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def xml_rec(value, key, quote=True):
    if hasattr(value, 'custom_xml') and callable(value.custom_xml):
        return value.custom_xml()
    elif isinstance(value, (dict, Storage)):
        return TAG[key](*[TAG[k](xml_rec(v, '', quote))
                          for k, v in value.items()])
    elif isinstance(value, list):
        return TAG[key](*[TAG.item(xml_rec(item, '', quote)) for item in value])
    elif hasattr(value, 'as_list') and callable(value.as_list):
        return str(xml_rec(value.as_list(), '', quote))
    elif hasattr(value, 'as_dict') and callable(value.as_dict):
        return str(xml_rec(value.as_dict(), '', quote))
    else:
        return xmlescape(value, quote) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:16,代码来源:serializers.py

示例5: apply_filter

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def apply_filter(self, message, symbols={}, filter=None, ftag=None):
        def get_tr(message, prefix, filter):
            s = self.get_t(message, prefix)
            return filter(s) if filter else self.filter(s)
        if filter:
            prefix = '@' + (ftag or 'userdef') + '\x01'
        else:
            prefix = '@' + self.ftag + '\x01'
        message = get_from_cache(
            self.cache, prefix + message,
            lambda: get_tr(message, prefix, filter))
        if symbols or symbols == 0 or symbols == "":
            if isinstance(symbols, dict):
                symbols.update(
                    (key, xmlescape(value).translate(ttab_in))
                    for key, value in iteritems(symbols)
                    if not isinstance(value, NUMBERS))
            else:
                if not isinstance(symbols, tuple):
                    symbols = (symbols,)
                symbols = tuple(
                    value if isinstance(value, NUMBERS)
                    else to_native(xmlescape(value)).translate(ttab_in)
                    for value in symbols)
            message = self.params_substitution(message, symbols)
        return to_native(XML(message.translate(ttab_out)).xml()) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:28,代码来源:languages.py

示例6: write

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def write(self, data, escape=True):
        if not escape:
            self.body.write(str(data))
        else:
            self.body.write(xmlescape(data)) 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:7,代码来源:globals.py

示例7: include_meta

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def include_meta(self):
        s = "\n"
        for meta in (self.meta or {}).iteritems():
            k, v = meta
            if isinstance(v, dict):
                s += '<meta' + ''.join(' %s="%s"' % (xmlescape(key), xmlescape(v[key])) for key in v) +' />\n'
            else:
                s += '<meta name="%s" content="%s" />\n' % (k, xmlescape(v))
        self.write(s, escape=False) 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:11,代码来源:globals.py

示例8: apply_filter

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def apply_filter(self, message, symbols={}, filter=None, ftag=None):
        def get_tr(message, prefix, filter):
            s = self.get_t(message, prefix)
            return filter(s) if filter else self.filter(s)
        if filter:
            prefix = '@' + (ftag or 'userdef') + '\x01'
        else:
            prefix = '@' + self.ftag + '\x01'
        message = get_from_cache(
            self.cache, prefix + message,
            lambda: get_tr(message, prefix, filter))
        if symbols or symbols == 0 or symbols == "":
            if isinstance(symbols, dict):
                symbols.update(
                    (key, xmlescape(value).translate(ttab_in))
                    for key, value in symbols.iteritems()
                    if not isinstance(value, NUMBERS))
            else:
                if not isinstance(symbols, tuple):
                    symbols = (symbols,)
                symbols = tuple(
                    value if isinstance(value, NUMBERS)
                    else xmlescape(value).translate(ttab_in)
                    for value in symbols)
            message = self.params_substitution(message, symbols)
        return XML(message.translate(ttab_out)) 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:28,代码来源:languages.py

示例9: write

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def write(self, data, escape=True):
        if not escape:
            self.body.write(str(data))
        else:
            # FIXME PY3:
            self.body.write(to_native(xmlescape(data))) 
开发者ID:rekall-innovations,项目名称:rekall-agent-server,代码行数:8,代码来源:globals.py

示例10: include_meta

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def include_meta(self):
        s = "\n"
        for meta in iteritems((self.meta or {})):
            k, v = meta
            if isinstance(v, dict):
                s += '<meta' + ''.join(' %s="%s"' % (xmlescape(key), to_native(xmlescape(v[key]))) for key in v) +' />\n'
            else:
                s += '<meta name="%s" content="%s" />\n' % (k, to_native(xmlescape(v)))
        self.write(s, escape=False) 
开发者ID:rekall-innovations,项目名称:rekall-agent-server,代码行数:11,代码来源:globals.py

示例11: include_meta

# 需要导入模块: from gluon import html [as 别名]
# 或者: from gluon.html import xmlescape [as 别名]
def include_meta(self):
        s = "\n";
        for meta in (self.meta or {}).iteritems():
            k,v = meta
            if isinstance(v,dict):
                s = s+'<meta'+''.join(' %s="%s"' % (xmlescape(key), xmlescape(v[key])) for key in v) +' />\n'
            else:
                s = s+'<meta name="%s" content="%s" />\n' % (k, xmlescape(v))
        self.write(s, escape=False) 
开发者ID:StuffShare,项目名称:StuffShare,代码行数:11,代码来源:globals.py


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