當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。