本文整理汇总了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())
示例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(),
)
示例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.
# """
#
示例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)
示例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'
示例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:
示例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()
示例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)
示例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)
示例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
示例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']
示例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):
示例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)
示例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()
示例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)