本文整理汇总了Python中SkunkWeb.ServiceRegistry类的典型用法代码示例。如果您正苦于以下问题:Python ServiceRegistry类的具体用法?Python ServiceRegistry怎么用?Python ServiceRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RemoteException
#
# $Id$
# Time-stamp: <01/05/09 14:36:02 smulloni>
########################################################################
import AE.Component
import exceptions
import new
import socket
import SocketScience
import cPickle
import types
from SkunkWeb.LogObj import DEBUG, logException
from SkunkWeb import ServiceRegistry
ServiceRegistry.registerService('remote_client')
REMOTE_CLIENT=ServiceRegistry.REMOTE_CLIENT
SWRC_PROTOCOL="swrc"
DEFAULT_PORT=9887
class RemoteException(Exception):
"""
a class that wraps a remotely raised exception
"""
def __init__(self, remoteInstance):
if isinstance(remoteInstance, Exception):
Exception.__init__(self, remoteInstance.args)
else:
Exception.__init__(self, remoteInstance)
self.remoteInstance=remoteInstance
示例2: getRemoteException
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#
# $Id$
# Time-stamp: <01/05/09 14:36:02 smulloni>
########################################################################
import AE.Component
import exceptions
import socket
import SocketScience
import cPickle
import types
from SkunkWeb.LogObj import DEBUG, logException
from SkunkWeb import ServiceRegistry
ServiceRegistry.registerService("remote_client")
REMOTE_CLIENT = ServiceRegistry.REMOTE_CLIENT
SWRC_PROTOCOL = "swrc"
DEFAULT_PORT = 9887
class RemoteException:
pass
def getRemoteException(realException):
"""
dynamically creates a RemoteException mixin
with the realException's class, and keeps
a copy of the realException in the 'remoteInstance'
示例3: _loadParfiles
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#
#$Id$
from SkunkWeb import Configuration, ServiceRegistry, LogObj
import marshal
import errno
import stat
ServiceRegistry.registerService('pars')
PARS=ServiceRegistry.PARS
DEBUG=LogObj.DEBUG
Configuration.mergeDefaults(
parFiles = [],
parFallthrough = 1
)
import templating
import AE.Cache
parDirs = {}
parContents = {}
def _loadParfiles(f):
示例4:
harmless. Then log using a log format like this:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{SKUNKTREK_ID}e" cookie-combined
Note that this only logs *incoming* cookies. This means that clients who
don't accept cookies won't generate spurious usertracking ids in the apache
logs, which is apparently a problem with apache's mod_usertrack.
"""
from SkunkWeb import Configuration, ServiceRegistry
from SkunkWeb.LogObj import DEBUG
from uuid import uuid
import time
import Cookie
ServiceRegistry.registerService('usertracking')
USERTRACKING=ServiceRegistry.USERTRACKING
_cookie_attrs=('path',
'expires',
'domain',
'comment',
'version',
'max-age')
_config_attrs=tuple([("usertrackingCookie%s" % \
x.replace('-', '_').capitalize(), x) \
for x in _cookie_attrs])
Configuration.mergeDefaults(
# whether usertracking is on
示例5: _fix
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
# Time-stamp: <01/05/04 17:32:39 smulloni>
########################################################################
from SkunkWeb import Configuration, ServiceRegistry, Hooks
from SkunkWeb.LogObj import DEBUG, DEBUGIT, logException
import os
import select
import sys
import rfc822
import cStringIO
ServiceRegistry.registerService('extcgi')
EXTCGI=ServiceRegistry.EXTCGI
Configuration.mergeDefaults(CGIProgram = None,
CGIProgramArgs = (),
CGIProgramBase = '')
def _fix(dict): #fixup the environment variables
nd = {}
for k,v in dict.items():
nd[str(k)] = str(v)
pb = Configuration.CGIProgramBase
if nd["SCRIPT_NAME"][:len(pb)] == pb:
remnant = nd["SCRIPT_NAME"][len(pb):]
if remnant:
nd["PATH_INFO"] = '/' + remnant
示例6: rollbackConnection
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#
from SkunkWeb import Configuration, LogObj, ServiceRegistry
from requestHandler.requestHandler import CleanupRequest
import Oracle
ServiceRegistry.registerService('oracle')
Configuration.mergeDefaults(
OracleConnectStrings = {},
OracleProcedurePackageLists = {}
)
for u, str in Configuration.OracleConnectStrings.items():
LogObj.DEBUG(ServiceRegistry.ORACLE, 'initializing user %s' % u)
Oracle.initUser(u, str)
for u, pkglist in Configuration.OracleProcedurePackageLists:
Oracle.loadSignatures(u, pkglist, LogObj.LOG,
lambda x: LogObj.DEBUG(ServiceRegistry.ORACLE, x))
def rollbackConnection(*args):
示例7: __initFlag
def __initFlag():
from SkunkWeb import ServiceRegistry
ServiceRegistry.registerService('web', 'WEB')
import SkunkWeb.Configuration as C
C.mergeDefaults(mergeQueryStringWithPostData=1,
HttpLoggingOn=0)
示例8: AecgiProtocol
# README file.
#
# $Id: aecgi.py,v 1.4 2003/05/01 20:45:53 drew_csillag Exp $
# Time-stamp: <01/05/04 17:32:39 smulloni>
########################################################################
from SkunkWeb import Configuration, ServiceRegistry, Hooks
from SkunkWeb.LogObj import DEBUG
import requestHandler.protocol
import requestHandler.requestHandler
from requestHandler.protocol import RequestFailed
import SocketScience
import marshal
ServiceRegistry.registerService('aecgi')
AECGI=ServiceRegistry.AECGI
class AecgiProtocol(requestHandler.protocol.Protocol):
"""
protocol used to communicate with Apache via mod_skunkweb
"""
def marshalRequest(self, sock, sessionDict):
"""
Sends a handshake byte, obtains the content length from
the value of the first ten bytes read, and then reads no
more than that amount, which it marshals with the 'marshal'
module. Finally, returns the marshalled request data
"""
SocketScience.send_it_all(sock, '\0')
示例9: getAuthorizationFromHeaders
#
from SkunkWeb import Configuration, ServiceRegistry
from SkunkWeb.LogObj import DEBUG
from requestHandler.protocol import PreemptiveResponse
import AE.Cache
import os
import Authenticator
import sys
import base64
Configuration.mergeDefaults(
basicAuthName = None,
basicAuthFile = None
)
ServiceRegistry.registerService("basicauth")
AUTH=ServiceRegistry.BASICAUTH
def getAuthorizationFromHeaders(conn, sessionDict):
"""
pulls REMOTE_USER, REMOTE_PASSWORD, and AUTH_TYPE out of request headers.
"""
DEBUG(AUTH, "looking for authorization headers")
auth = conn.requestHeaders.get('Authorization',
conn.requestHeaders.get('Proxy-Authorization'))
if auth:
DEBUG(AUTH, "found authorization")
conn.authType, ai = auth.split()
ucp = base64.decodestring(ai)
colon_idx = ucp.find(':')
conn.remoteUser = ucp[:colon_idx]
示例10: _fixPath
``rewrite.RewriteCond``, that performs most of the tests you'll want
to perform -- exactly the same tests as you would perform while
scoping.
By default, all of your rewrite rules will be applied, one by one.
But if you want it to stop after the first match, set
``Configuration.rewriteApplyAll`` to a false value.
This service used to contain a series of hooks and the ability
to use them to manipulate the list of rewrite rules at runtime.
These were relatively expensive and seemed to offer little functionality,
so they have been removed.
"""
from SkunkWeb import ServiceRegistry, Configuration, constants
ServiceRegistry.registerService('rewrite')
from SkunkWeb.LogObj import DEBUG, logException
from SkunkWeb.ServiceRegistry import REWRITE
import re
import sys
from requestHandler.protocol import PreemptiveResponse
from skunklib import normpath
def _fixPath(root, path):
return normpath('%s/%s' % (root,path))
Configuration.mergeDefaults(rewriteBeforeScope=1,
rewriteRules = [],
rewriteApplyAll = 1,
rewriteMatchToArgs=1)
示例11: __initFlag
def __initFlag():
from SkunkWeb import ServiceRegistry
ServiceRegistry.registerService("userdir")
示例12: Copyright
#
# Copyright (C) 2002 Drew 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.
#
# $Id$
########################################################################
from SkunkWeb import Configuration, ServiceRegistry, Hooks
from SkunkWeb.LogObj import DEBUG
Configuration.mergeDefaults(pspTemplateTypes=[], pspTopLevelInterpret=1)
ServiceRegistry.registerService('psptemplate')
PSP=ServiceRegistry.PSPTEMPLATE
from DT import DT_REGULAR, DT_DATA, DT_INCLUDE
import AE.Cache
import AE.CodeSources
import AE.Executables
import psp
PSP_CACHEFILE_VERSION = 1
def _pspCompileFunc( name, data ):
return psp.psp_compile( data, name )
def getPSPCode( name, srcModTime ):
return AE.Cache._getCompiledThing( name, srcModTime, 'psptemplate',
_pspCompileFunc,
示例13: __initFlag
def __initFlag():
import SkunkWeb.ServiceRegistry as sr
sr.registerService('webdav')
示例14: __init__
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
# Time-stamp: <01/05/04 17:32:39 smulloni>
########################################################################
from SkunkWeb import Configuration, ServiceRegistry, Hooks
from SkunkWeb.LogObj import DEBUG, ERROR
import requestHandler.protocol
import requestHandler.requestHandler
import SocketScience
import skunklib
import fcgi
ServiceRegistry.registerService('fcgiprot')
FCGIPROT=ServiceRegistry.FCGIPROT
RequestFailed=Hooks.KeyedHook()
class sockfile:
def __init__(self):
self.contents=[]
def send(self, c):
DEBUG(FCGIPROT, 'sending %s' % c)
self.contents.append(c)
def value(self):
return ''.join(self.contents)
示例15: __initFlag
def __initFlag():
ServiceRegistry.registerService("remote")