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


Python restricted.RestrictedError方法代码示例

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


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

示例1: app_compile

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def app_compile(app, request, skip_failed_views=False):
    """Compiles the application

    Args:
        app(str): application name
        request: the global request object

    Returns:
        None if everything went ok, traceback text if errors are found

    """
    from gluon.compileapp import compile_application, remove_compiled_application
    folder = apath(app, request)
    try:
        failed_views = compile_application(folder, skip_failed_views)
        return failed_views
    except (Exception, RestrictedError):
        tb = traceback.format_exc()
        remove_compiled_application(folder)
        return tb 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:22,代码来源:admin.py

示例2: app_compile

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def app_compile(app, request, skip_failed_views=False):
    """Compiles the application

    Args:
        app(str): application name
        request: the global request object

    Returns:
        None if everything went ok, traceback text if errors are found

    """
    from compileapp import compile_application, remove_compiled_application
    folder = apath(app, request)
    try:
        failed_views = compile_application(folder, skip_failed_views)
        return failed_views
    except (Exception, RestrictedError):
        tb = traceback.format_exc(sys.exc_info)
        remove_compiled_application(folder)
        return tb 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:22,代码来源:admin.py

示例3: app_compile

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def app_compile(app, request, skip_failed_views=False):
    """Compiles the application

    Args:
        app(str): application name
        request: the global request object

    Returns:
        None if everything went ok, traceback text if errors are found

    """
    from compileapp import compile_application, remove_compiled_application
    folder = apath(app, request)
    try:
        failed_views = compile_application(folder, skip_failed_views)
        return failed_views
    except (Exception, RestrictedError):
        tb = traceback.format_exc()
        remove_compiled_application(folder)
        return tb 
开发者ID:TechMaz,项目名称:Problematica-public,代码行数:22,代码来源:admin.py

示例4: app_compile

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def app_compile(app, request):
    """Compiles the application

    Args:
        app(str): application name
        request: the global request object

    Returns:
        None if everything went ok, traceback text if errors are found

    """
    from compileapp import compile_application, remove_compiled_application
    folder = apath(app, request)
    try:
        compile_application(folder)
        return None
    except (Exception, RestrictedError):
        tb = traceback.format_exc(sys.exc_info)
        remove_compiled_application(folder)
        return tb 
开发者ID:StuffShare,项目名称:StuffShare,代码行数:22,代码来源:admin.py

示例5: RestrictedError

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def RestrictedError(a, b, c):
        logging.error(str(a) + ':' + str(b) + ':' + str(c))
        return RuntimeError 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:5,代码来源:template.py

示例6: _raise_error

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def _raise_error(self, message='', text=None):
        """
        Raises an error using itself as the filename and textual content.
        """
        raise RestrictedError(self.name, text or self.text, message) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:7,代码来源:template.py

示例7: parse_template

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def parse_template(filename,
                   path='views/',
                   context=dict(),
                   lexers={},
                   delimiters=('{{', '}}')
                   ):
    """
    Args:
        filename: can be a view filename in the views folder or an input stream
        path: is the path of a views folder
        context: is a dictionary of symbols used to render the template
        lexers: dict of custom lexers to use
        delimiters: opening and closing tags
    """

    # First, if we have a str try to open the file
    if isinstance(filename, str):
        fname = os.path.join(path, filename)
        try:
            with open(fname, 'rb') as fp:
                text = fp.read()
        except IOError:
            raise RestrictedError(filename, '', 'Unable to find the file')
    else:
        text = filename.read()
    text = to_native(text)
    # Use the file contents to get a parsed template and return it.
    return str(TemplateParser(text, context=context, path=path, lexers=lexers, delimiters=delimiters)) 
开发者ID:HackPucBemobi,项目名称:touch-pay-client,代码行数:30,代码来源:template.py

示例8: parse_template

# 需要导入模块: from gluon import restricted [as 别名]
# 或者: from gluon.restricted import RestrictedError [as 别名]
def parse_template(filename,
                   path='views/',
                   context=dict(),
                   lexers={},
                   delimiters=('{{', '}}')
                   ):
    """
    Args:
        filename: can be a view filename in the views folder or an input stream
        path: is the path of a views folder
        context: is a dictionary of symbols used to render the template
        lexers: dict of custom lexers to use
        delimiters: opening and closing tags
    """

    # First, if we have a str try to open the file
    if isinstance(filename, str):
        try:
            fp = open(os.path.join(path, filename), 'rb')
            text = fp.read()
            fp.close()
        except IOError:
            raise RestrictedError(filename, '', 'Unable to find the file')
    else:
        text = filename.read()

    # Use the file contents to get a parsed template and return it.
    return str(TemplateParser(text, context=context, path=path, lexers=lexers, delimiters=delimiters)) 
开发者ID:lucadealfaro,项目名称:true_review_web2py,代码行数:30,代码来源:template.py


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