當前位置: 首頁>>代碼示例>>Python>>正文


Python SkunkWeb.ServiceRegistry類代碼示例

本文整理匯總了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
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:remote_client.py

示例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'
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:remote_client.py

示例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):
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:__init__.py

示例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
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:usertracking.py

示例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
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:extcgi.py

示例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):
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:__init__.py

示例7: __initFlag

def __initFlag():
    from SkunkWeb import ServiceRegistry
    ServiceRegistry.registerService('web', 'WEB')
    import SkunkWeb.Configuration as C
    C.mergeDefaults(mergeQueryStringWithPostData=1,
                    HttpLoggingOn=0)
開發者ID:drewcsillag,項目名稱:skunkweb,代碼行數:6,代碼來源:__init__.py

示例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')
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:aecgi.py

示例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]
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:__init__.py

示例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)
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:30,代碼來源:rewrite.py

示例11: __initFlag

def __initFlag():
    from SkunkWeb import ServiceRegistry

    ServiceRegistry.registerService("userdir")
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:4,代碼來源:userdir.py

示例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,
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:31,代碼來源:psptemplate.py

示例13: __initFlag

def __initFlag():
    import SkunkWeb.ServiceRegistry as sr
    sr.registerService('webdav')
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:3,代碼來源:__init__.py

示例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)
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:30,代碼來源:fcgiprot.py

示例15: __initFlag

def __initFlag():
    ServiceRegistry.registerService("remote")
開發者ID:BackupTheBerlios,項目名稱:skunkweb-svn,代碼行數:2,代碼來源:__init__.py


注:本文中的SkunkWeb.ServiceRegistry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。