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


Python Configuration.mergeDefaults方法代码示例

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


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

示例1: __initConfig

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
def __initConfig():
    from AE import cfg
    from SkunkWeb import Configuration, confvars
    # set our defaults from AE defaults
    Configuration.mergeDefaults(
        documentRoot = confvars.DEFAULT_DOCROOT,
        compileCacheRoot = confvars.DEFAULT_CACHE, 
        componentCacheRoot = confvars.DEFAULT_CACHE,
        failoverComponentCacheRoot = "%s/failoverCache" % Configuration.SkunkRoot,
        mimeTypesFile = confvars.DEFAULT_MIME_TYPES_FILE_NAME,
        componentCommentLevel = 0,
        )
    dd = {}
    for k, v in cfg.Configuration._d.items():
        if k not in ['documentRoot',
                     'compileCacheRoot',
                     'componentCacheRoot',
                     'failoverComponentCacheRoot',
                     'mimeTypesFile',
                     'componentCommentLevel']:
            dd[k]=v
    Configuration.mergeDefaults(dd)
            
    # set AE's config object to ours
    cfg.Configuration = Configuration
    __checkScopes(Configuration.scopeMatchers())
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:28,代码来源:ae_component.py

示例2: __initConfig

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
def __initConfig():
    import SkunkWeb.Configuration as C
    import os
    C.mergeDefaults(
        webdavDB=os.join(C.SkunkRoot, 'var/run/WEBDAVdb'),
        webdavFS=fs.WebdavFS(),
        )
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:9,代码来源:__init__.py

示例3: OK

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
#   

from SkunkWeb import Configuration, ServiceRegistry
from SkunkWeb.LogObj import DEBUG, ERROR, logException
from requestHandler.protocol import PreemptiveResponse
import AE.Cache
import AE.Component
import os
import Authenticator
import sys
import base64
import armor

Configuration.mergeDefaults(
    authAuthorizer = None,
    authActivated = None,
    authAuthorizerCtorArgs = (),
    )
ServiceRegistry.registerService("auth")
AUTH=ServiceRegistry.AUTH

class OK(Exception): pass

# an authorizer 
#class authorizer:
#    def __init__(self, ......):
#    """
#    The ...... will be filled with the contents of
#    Configuration.authAuthorizerCtorArgs when this object is instantiated.
#    """
#
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:__init__.py

示例4: __initConfig

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
def __initConfig():
    from SkunkWeb import Configuration
    Configuration.mergeDefaults(DocumentTimeout=30,
                                PostResponseTimeout=20,
                                job=None)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:7,代码来源:__init__.py

示例5: _do_redirect

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
import SkunkWeb.Configuration as Cfg
from SkunkWeb import Context
from web.protocol import RouteConnection
from SkunkWeb.constants import WEB_JOB

# the controller service is required
import controller

# make sure that the context object is installed
import context

from mvc.log import debug

__all__=['url_for', 'redirect_to']

Cfg.mergeDefaults(routes=[])

def _do_redirect(url):
    Context.Connection.redirect(url)

def routing_hook(connection, sessionDict):
    if not Cfg.MvcOn:
        return
    debug("in routing hook")
    # initialize routes request config
    rcfg=request_config()
    rcfg.redirect=_do_redirect
    rcfg.mapper=map=Mapper()
    rcfg.host=connection.host
    if connection.env.get('HTTPS', False):
        rcfg.protocol='HTTPS'
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:routing.py

示例6: PIL

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
import AE.Component
from web.protocol import Redirect
from SkunkWeb.LogObj import DEBUG
from SkunkWeb.ServiceRegistry import TEMPLATING
import SkunkWeb.Configuration as Config

# for img tag, try to import PIL (to get default image width and height)
try:
    import PIL.Image as Image
    import AE.Cache as Cache
    _havePIL=1
    import pil_preload
except:
    _havePIL=0

Config.mergeDefaults(tagsGenerateXHTML=1,
                     autosizeImages=1)
                     

def _genUrl ( path, query = {}, need_full = 0, noescape=None ):
    """
    Generate the URL given a URI. If need_full is 1, the generated URL 
    will contain the server part.
    """

    if noescape is None:
	path = urllib.quote(path)

    if query:
        path = path + skunklib.urlencode ( query )

    if need_full:
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:34,代码来源:UrlBuilder.py

示例7: Copyright

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
#  Copyright (C) 2001 Andrew T. Csillag <[email protected]>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#
########################################################################

from SkunkWeb import Configuration
import MySQL
from SkunkExcept import SkunkStandardError
from requestHandler.requestHandler import CleanupRequest

Configuration.mergeDefaults(
    MySQLConnectParams = {},
    MySQLRollback=0,
    MySQLTestFunc=None
    )

# add test function (used by MySQL connection cache to test
# connections before handing them out)
MySQL.connection_test=Configuration.MySQLTestFunc

for u, p in Configuration.MySQLConnectParams.items():
    MySQL.initUser(u, p)

# optional rollback
def rollback(*args):
    for v in MySQL._connections.values():
        try:
            v.rollback()
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:__init__.py

示例8: Copyright

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
########################################################################
#  Copyright (C) 2004 Andrew T. Csillag <[email protected]>,
#                     Jacob Smullyan <[email protected]>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
########################################################################

from SkunkWeb import Configuration
import PsycopgCache

Configuration.mergeDefaults(PsycopgConnectParams = {})

for u, p in Configuration.PsycopgConnectParams.items():
    PsycopgCache.initUser (u, p)

def rollback(*args):
    for v in PsycopgCache._connections.values():
        v.rollback()

from requestHandler.requestHandler import CleanupRequest
CleanupRequest.addFunction(rollback)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:25,代码来源:psycopgcache.py

示例9: __initFlag

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
def __initFlag():
    from SkunkWeb import ServiceRegistry
    ServiceRegistry.registerService('web', 'WEB')
    import SkunkWeb.Configuration as C
    C.mergeDefaults(mergeQueryStringWithPostData=1,
                    HttpLoggingOn=0)
开发者ID:drewcsillag,项目名称:skunkweb,代码行数:8,代码来源:__init__.py

示例10: _verify_cookie

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
_config_attrs=tuple([("usertrackingCookie%s" % \
                      x.replace('-', '_').capitalize(), x) \
                     for x in _cookie_attrs])

Configuration.mergeDefaults(
    # whether usertracking is on
    usertrackingOn=0,
    # whether Configuration.usertrackingCookieExpires is an
    # absolute timestamp, or an interval to be added to the
    # current time (the latter is the default)
    usertrackingExpiresAbsolute=0,
    # function to generate unique ids; should take one argument,
    # the CONNECTION.  If None, a uuid will be generated.
    usertrackingGenUIDFunc=None,
    # function to verify a usertracking cookie;
    # by default, None
    usertrackingVerifyCookieFunc=None,
    # name of the cookie
    usertrackingCookieName="SKUNKTREK_ID",
    # values for cookie parameters
    usertrackingCookiePath=None,
    usertrackingCookieExpires=None,
    usertrackingCookieDomain=None,
    usertrackingCookieComment=None,
    usertrackingCookieVersion=None,
    usertrackingCookieMax_age=None)

def _verify_cookie(conn, cookiename):
    if conn.requestCookie.has_key(cookiename):
        v=conn.requestCookie[cookiename]
        f=Configuration.usertrackingVerifyCookieFunc
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:usertracking.py

示例11: out

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
                 from_addr=None,
                 to_addrs=[]):
        self.from_addr=from_addr
        self.to_addrs=to_addrs 

    def out(self, msg, job):
        self.send(msg, 'SkunkWeb Cron Output: %s' % str(job.jobFunc))

    def err(self, msg, job):
        self.send(msg, "SkunkWeb Cron Error: %s" % str(job.jobFunc))

    def send(self, msg,subject):
        to_addrs=self.to_addrs or _C.CronToAddrs
        from_addr=self.from_addr or _C.CronFromAddress or _C.FromAddress
        sendmail(to_addrs,
                 subject,
                 msg,
                 from_addr=from_addr)        

_C.mergeDefaults(CronJobs=[],
                 CronLogger=SkunkMailLogger(),
                 CronFromAddress=None,
                 CronToAddrs=None)


CronTab=cronjob.CronTab(logger=_C.CronLogger,
                        cronjobs=_C.CronJobs)


__all__=['CronTab', 'SkunkMailLogger']
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:32,代码来源:cron.py

示例12: __init__

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
import time
import types
import browser
from SkunkWeb.Hooks import KeyedHook, Hook
import argextract
import base64
import md5
try:
    import gzip
except:
    pass
import re
rangere = re.compile(r'bytes=([0-9]*)-([0-9]*)$')

Configuration.mergeDefaults(
    textCompression=0,
    generateEtagHeader=1,
    )
headersOnlyMethods=['HEAD'] 
headersOnlyStatuses=[100, 101, 102, 204, 304]

HaveConnection=KeyedHook()
PreHandleConnection=KeyedHook()
RouteConnection=KeyedHook()
HandleConnection=KeyedHook()
ProcessResponse=Hook()

class HTTPConnection:
    '''
    The connection object used for HTTP, passed to various web hooks.
    '''
    def __init__(self, requestData):
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:34,代码来源:protocol.py

示例13: redirectStdOutErr

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
        else:
            self.lbuf = ''
            
def redirectStdOutErr():
    if sys.__stderr__ == sys.stderr and not sys.stderr.isatty():
        sys.stderr = Redirector(Logger.ERROR)
    if sys.__stderr__ == sys.stderr and not sys.stdout.isatty():
        sys.stdout = Redirector(Logger.LOG)

########################################################################        

Configuration.mergeDefaults(
    accessLog =  confvars.DEFAULT_ACCESS_LOG,
    errorLog =   confvars.DEFAULT_ERROR_LOG,
    regularLog = confvars.DEFAULT_REGULAR_LOG,
    debugLog =   confvars.DEFAULT_DEBUG_LOG,
    httpAccessLog = confvars.DEFAULT_HTTP_ACCESS_LOG,
    stampEveryLine = 1,
    logDateFormat = '%a, %d %b %Y %H:%M:%S GMT',
    initialDebugServices=[]
    )

Logger._logStamp = "[%d]initializing... %%s -- " % os.getpid()

# enable the logger to print the service name from the debug flag passed
# to debug statements.
Logger.getSourceFromKind=ServiceRegistry.getSourceFromKind
Logger.config=Configuration        

Hooks.ServerStart.append(Logger.initLogStamp)
Hooks.ServerStart.append(redirectStdOutErr)
Hooks.ChildStart.append(Logger.initLogStamp)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:34,代码来源:LogObj.py

示例14: ERROR

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
will affect all products, or by adding the product-name to the
Configuration.productPaths mapping.

This service will also contain a utility for creating products, creating
the MANIFEST file, byte-compiling the python modules, and creating the
archive file.
"""

import SkunkWeb.Configuration as Cfg
from loader import *
from manifest import *
import os

Cfg.mergeDefaults(productDirectory='products',
                  products='*',
                  defaultProductPath='products',
                  productPaths={},
                  )

proddir=loader.product_directory()
if not os.path.isdir(proddir):
    try:
        os.makedirs(proddir)
    except:
        ERROR(("product service needs a product directory,"
               "currently configured as %s") % proddir)
        raise
del proddir

for p in loader.listProducts():
    p.load()
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:33,代码来源:__init__.py

示例15: Copyright

# 需要导入模块: from SkunkWeb import Configuration [as 别名]
# 或者: from SkunkWeb.Configuration import mergeDefaults [as 别名]
########################################################################
#  Copyright (C) 2002 Andrew T. Csillag <[email protected]>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
########################################################################

from SkunkWeb import Configuration
import PyPgSQLcache

Configuration.mergeDefaults(
    PyPgSQLConnectParams = {},
    )

for u, p in Configuration.PyPgSQLConnectParams.items():
    PyPgSQLcache.initUser ( u, p )

def rollback(*args):
    for v in PyPgSQLcache._connections.values():
        v.rollback()

from requestHandler.requestHandler import CleanupRequest
CleanupRequest.addFunction(rollback)
开发者ID:BackupTheBerlios,项目名称:skunkweb-svn,代码行数:26,代码来源:pypgsqlcache.py


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