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


Python DrupyPHP.session_start方法代码示例

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


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

示例1: _drupal_bootstrap

# 需要导入模块: from lib.drupy import DrupyPHP [as 别名]
# 或者: from lib.drupy.DrupyPHP import session_start [as 别名]
def _drupal_bootstrap(phase):
    if phase == DRUPAL_BOOTSTRAP_CONFIGURATION:
        drupal_initialize_variables()
        # Start a page timer:
        timer_start("page")
        # Initialize the configuration
        conf_init()
    elif phase == DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE:
        # Allow specifying special cache handlers in settings.php, like
        # using memcached or files for storing cache information.
        # If the page_cache_fastpath is set to TRUE in settings.php and
        # page_cache_fastpath (implemented in the special implementation of
        # cache.inc) printed the page and indicated this with a returned TRUE
        # then we are done.
        if variable_get("page_cache_fastpath", False) and page_cache_fastpath():
            exit()
    elif phase == DRUPAL_BOOTSTRAP_DATABASE:
        # Initialize the database system.  Note that the connection
        # won't be initialized until it is actually requested.
        # ! do nothing !
        # Register autoload functions so that we can access classes and interfaces.
        # spl_autoload_register('drupal_autoload_class')
        # spl_autoload_register('drupal_autoload_interface')
        pass
    elif phase == DRUPAL_BOOTSTRAP_ACCESS:
        # Deny access to blocked IP addresses - t() is not yet available
        if drupal_is_denied(ip_address()):
            php.header(php.SERVER["SERVER_PROTOCOL"] + " 403 Forbidden")
            print "Sorry, " + check_plain(ip_address()) + " has been banned."
            exit()
    elif phase == DRUPAL_BOOTSTRAP_SESSION:
        php.session_set_save_handler(
            "_sess_open", "_sess_close", "_sess_read", "_sess_write", "_sess_destroy_sid", "_sess_gc"
        )
        php.session_start()
    elif phase == DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE:
        # Initialize configuration variables, using values from settings.php
        # if available.
        settings.conf = variable_init(({} if (settings.conf == None) else settings.conf))
        # Load plugin handling.
        cache_mode = variable_get("cache", CACHE_DISABLED)
        # Get the page from the cache.
        cache = "" if (cache_mode == CACHE_DISABLED) else page_get_cache()
        # If the skipping of the bootstrap hooks is not enforced, call hook_boot.
        if cache_mode != CACHE_AGGRESSIVE:
            invoke_all("boot")
        # If there is a cached page, display it.
        if cache:
            drupal_page_cache_header(cache)
            # If the skipping of the bootstrap hooks is not enforced, call hook_exit.
            if cache_mode != CACHE_AGGRESSIVE:
                bootstrap_invoke_all("exit")
            # We are done.
            exit()
        # Prepare for non-cached page workflow.
        drupal_page_header()
    elif phase == DRUPAL_BOOTSTRAP_LANGUAGE:
        drupal_init_language()
    elif phase == DRUPAL_BOOTSTRAP_PATH:
        # Initialize php.GET['q'] prior to loading plugins and invoking hook_init().
        # lib_path.drupal_init_path();
        pass
    elif phase == DRUPAL_BOOTSTRAP_FULL:
        lib_common._drupal_bootstrap_full()
开发者ID:sabren,项目名称:drupy,代码行数:66,代码来源:bootstrap.py


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