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


Python BaseAdapter.set_folder方法代码示例

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


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

示例1: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session, store_current=True):
    """
    Build the environment dictionary into which web2py files are executed.
    """
    h,v = html,validators
    environment = dict((k,getattr(h,k)) for k  in h.__all__)
    environment.update((k,getattr(v, k)) for k in v.__all__)
    if not request.env:
        request.env = Storage()
    # Enable standard conditional models (i.e., /*.py, /[controller]/*.py, and
    # /[controller]/[function]/*.py)
    response.models_to_run = [r'^\w+\.py$', r'^%s/\w+\.py$' % request.controller,
        r'^%s/%s/\w+\.py$' % (request.controller, request.function)]
        
    t = environment['T'] = translator(request)
    c = environment['cache'] = Cache(request)
    if store_current:
        current.globalenv = environment
        current.request = request
        current.response = response
        current.session = session
        current.T = t
        current.cache = c

    global __builtins__
    if is_jython: # jython hack
        __builtins__ = mybuiltin()
    elif is_pypy: # apply the same hack to pypy too
        __builtins__ = mybuiltin()
    else:
        __builtins__['__import__'] = __builtin__.__import__ ### WHY?
    environment['__builtins__'] = __builtins__
    environment['HTTP'] = HTTP
    environment['redirect'] = redirect
    environment['request'] = request
    environment['response'] = response
    environment['session'] = session
    environment['DAL'] = DAL
    environment['Field'] = Field
    environment['SQLDB'] = SQLDB        # for backward compatibility
    environment['SQLField'] = SQLField  # for backward compatibility
    environment['SQLFORM'] = SQLFORM
    environment['SQLTABLE'] = SQLTABLE
    environment['LOAD'] = LOAD
    environment['local_import'] = \
        lambda name, reload=False, app=request.application:\
        local_import_aux(name,reload,app)
    BaseAdapter.set_folder(pjoin(request.folder, 'databases'))
    response._view_environment = copy.copy(environment)
    return environment
开发者ID:mycguo,项目名称:Charles-Web2Py,代码行数:52,代码来源:compileapp.py

示例2: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session, store_current=True):
    """
    Build the environment dictionary into which web2py files are executed.
    """

    environment = {}
    for key in html.__all__:
        environment[key] = getattr(html, key)
    for key in validators.__all__:
        environment[key] = getattr(validators, key)
    if not request.env:
        request.env = Storage()

    t = environment['T'] = translator(request)
    c = environment['cache'] = Cache(request)
    if store_current:
        current.globalenv = environment
        current.request = request
        current.response = response
        current.session = session
        current.T = t
        current.cache = c

    global __builtins__
    if is_jython: # jython hack
        __builtins__ = mybuiltin()
    elif is_pypy: # apply the same hack to pypy too
        __builtins__ = mybuiltin()
    else:
        __builtins__['__import__'] = __builtin__.__import__ ### WHY?
    environment['__builtins__'] = __builtins__
    environment['HTTP'] = HTTP
    environment['redirect'] = redirect
    environment['request'] = request
    environment['response'] = response
    environment['session'] = session
    environment['DAL'] = DAL
    environment['Field'] = Field
    environment['SQLDB'] = SQLDB        # for backward compatibility
    environment['SQLField'] = SQLField  # for backward compatibility
    environment['SQLFORM'] = SQLFORM
    environment['SQLTABLE'] = SQLTABLE
    environment['LOAD'] = LOAD
    environment['local_import'] = \
        lambda name, reload=False, app=request.application:\
        local_import_aux(name,reload,app)
    BaseAdapter.set_folder(os.path.join(request.folder, 'databases'))
    response._view_environment = copy.copy(environment)
    return environment
开发者ID:MoMaT,项目名称:web2py,代码行数:51,代码来源:compileapp.py

示例3: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session, store_current=True):
    """
    Build the environment dictionary into which web2py files are executed.
    """
    h, v = html, validators
    environment = dict((k, getattr(h, k)) for k in h.__all__)
    environment.update((k, getattr(v, k)) for k in v.__all__)
    if not request.env:
        request.env = Storage()

    t = environment["T"] = translator(request)
    c = environment["cache"] = Cache(request)
    if store_current:
        current.globalenv = environment
        current.request = request
        current.response = response
        current.session = session
        current.T = t
        current.cache = c

    global __builtins__
    if is_jython:  # jython hack
        __builtins__ = mybuiltin()
    elif is_pypy:  # apply the same hack to pypy too
        __builtins__ = mybuiltin()
    else:
        __builtins__["__import__"] = __builtin__.__import__  ### WHY?
    environment["__builtins__"] = __builtins__
    environment["HTTP"] = HTTP
    environment["redirect"] = redirect
    environment["request"] = request
    environment["response"] = response
    environment["session"] = session
    environment["DAL"] = DAL
    environment["Field"] = Field
    environment["SQLDB"] = SQLDB  # for backward compatibility
    environment["SQLField"] = SQLField  # for backward compatibility
    environment["SQLFORM"] = SQLFORM
    environment["SQLTABLE"] = SQLTABLE
    environment["LOAD"] = LOAD
    environment["local_import"] = lambda name, reload=False, app=request.application: local_import_aux(
        name, reload, app
    )
    BaseAdapter.set_folder(pjoin(request.folder, "databases"))
    response._view_environment = copy.copy(environment)
    return environment
开发者ID:mariuz,项目名称:web2py,代码行数:48,代码来源:compileapp.py

示例4: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session, store_current=True):
    """
    Build the environment dictionary into which web2py files are executed.
    """
    # h,v = html,validators
    environment = dict(_base_environment_)

    if not request.env:
        request.env = Storage()
    # Enable standard conditional models (i.e., /*.py, /[controller]/*.py, and
    # /[controller]/[function]/*.py)
    response.models_to_run = [
        r"^\w+\.py$",
        r"^%s/\w+\.py$" % request.controller,
        r"^%s/%s/\w+\.py$" % (request.controller, request.function),
    ]

    t = environment["T"] = translator(os.path.join(request.folder, "languages"), request.env.http_accept_language)
    c = environment["cache"] = Cache(request)

    if store_current:
        current.globalenv = environment
        current.request = request
        current.response = response
        current.session = session
        current.T = t
        current.cache = c

    global __builtins__
    if is_jython:  # jython hack
        __builtins__ = mybuiltin()
    elif is_pypy:  # apply the same hack to pypy too
        __builtins__ = mybuiltin()
    else:
        __builtins__["__import__"] = __builtin__.__import__  # WHY?
    environment["request"] = request
    environment["response"] = response
    environment["session"] = session
    environment["local_import"] = lambda name, reload=False, app=request.application: local_import_aux(
        name, reload, app
    )
    BaseAdapter.set_folder(pjoin(request.folder, "databases"))
    response._view_environment = copy.copy(environment)
    custom_import_install()
    return environment
开发者ID:vjanma,项目名称:web2py,代码行数:47,代码来源:compileapp.py

示例5: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session, store_current=True):
    """
    Build the environment dictionary into which web2py files are executed.
    """
    #h,v = html,validators
    environment = dict(_base_environment_)

    if not request.env:
        request.env = Storage()
    # Enable standard conditional models (i.e., /*.py, /[controller]/*.py, and
    # /[controller]/[function]/*.py)
    response.models_to_run = [r'^\w+\.py$', r'^%s/\w+\.py$' % request.controller,
                              r'^%s/%s/\w+\.py$' % (request.controller, request.function)]

    t = environment['T'] = translator(request)
    c = environment['cache'] = Cache(request)

    if store_current:
        current.globalenv = environment
        current.request = request
        current.response = response
        current.session = session
        current.T = t
        current.cache = c

    global __builtins__
    if is_jython:  # jython hack
        __builtins__ = mybuiltin()
    elif is_pypy:  # apply the same hack to pypy too
        __builtins__ = mybuiltin()
    else:
        __builtins__['__import__'] = __builtin__.__import__  # WHY?
    environment['request'] = request
    environment['response'] = response
    environment['session'] = session
    environment['local_import'] = \
        lambda name, reload=False, app=request.application:\
        local_import_aux(name, reload, app)
    BaseAdapter.set_folder(pjoin(request.folder, 'databases'))
    response._view_environment = copy.copy(environment)
    custom_import_install()
    return environment
开发者ID:luisibanez,项目名称:openshift_web2py,代码行数:44,代码来源:compileapp.py

示例6: build_environment

# 需要导入模块: from dal import BaseAdapter [as 别名]
# 或者: from dal.BaseAdapter import set_folder [as 别名]
def build_environment(request, response, session):
    """
    Build the environment dictionary into which web2py files are executed.
    """

    environment = {}
    for key in html.__all__:
        environment[key] = getattr(html, key)
    for key in validators.__all__:
        environment[key] = getattr(validators, key)
    if not request.env:
        request.env = Storage()

    current.request = request
    current.response = response
    current.session = session
    current.T = environment['T'] = translator(request)
    current.cache = environment['cache'] = Cache(request)

    environment['HTTP'] = HTTP
    environment['redirect'] = redirect
    environment['request'] = request
    environment['response'] = response
    environment['session'] = session
    environment['DAL'] = DAL
    environment['Field'] = Field
    environment['SQLDB'] = SQLDB        # for backward compatibility
    environment['SQLField'] = SQLField  # for backward compatibility
    environment['SQLFORM'] = SQLFORM
    environment['SQLTABLE'] = SQLTABLE
    environment['LOAD'] = LoadFactory(environment)
    environment['local_import'] = \
        lambda name, reload=False, app=request.application:\
        local_import_aux(name,reload,app)
    BaseAdapter.set_folder(os.path.join(request.folder, 'databases'))
    response._view_environment = copy.copy(environment)
    return environment
开发者ID:FHFard,项目名称:MNPP,代码行数:39,代码来源:compileapp.py


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