コード例 #1
0
        the content length.
        """
        return self._marshalData(response)

    def marshalException(self, ctxt, exc_info=None):
        """should return response data appropriate for the current exception.
        """
        if exc_info is None:
            exc_info=sys.exc_info()
        res=RequestFailed(ctxt, exc_info)

        if res:
            return self._marshalData(res)
        else:
            exc_text=''.join(format_exception(*exc_info))
            return self._marshalData(exc_text)

    def _marshalData(self, data):
        return "%10d%s" %(len(data), data)

def serviceInit():
    """service initialization function"""
    if Configuration.AecgiListenPorts:
        addRequestHandler(AecgiProtocol(),
                          Configuration.AecgiListenPorts)    

mergeDefaults(AecgiListenPorts=['TCP:localhost:9888'])



コード例 #2
0
def configDefaults():
    mergeDefaults(pidFile='/tmp/skunk_server.pid',
                  run_group=None,
                  run_user=None,
                  services=(),
                  jobs=())
コード例 #3
0
ファイル: web.py プロジェクト: BackupTheBerlios/skunkweb-svn
from skunk.web.config import mergeDefaults
from skunk.util.hooks import Hook
from skunk.util.gziputil import TimelessGzipFile
from skunk.web.util.status import http_statuses, headersonlyStatuses

mergeDefaults(textCompression=False,
              generateEtagHeader=True,
              HttpLoggingOn=False)

headersOnlyMethods=('HEAD',)

# hooks declared here
HaveConnection=Hook()
PreHandleConnection=Hook()
HandleConnection=Hook()
ProcessResponse=Hook()

class Redirect(Exception):
    pass

class NullOutput:
    def write(self, *args): pass
    def getvalue(self):
        return ''

def _processRequest(requestData, ctxt):
    """
    request handling functioning for requestHandler's
    HandleRequest hook.
    """
    response=None
コード例 #4
0
from skunk.web.config import (Configuration, updateConfig, _scopeman,
                              mergeDefaults)

import signal
import socket
import errno

# create standard logging methods
loginit(make_all=False)

__all__ = [
    'HandleRequest', 'PostResponse', 'RequestFailed', 'addRequestHandler',
    'DocumentTimeout', 'ClientProtocol'
]

mergeDefaults(DocumentTimeout=30, PostResponseTimeout=20, jobs=())

# hooks
HandleRequest = Hook()
PostResponse = Hook()


def processRequest(sock, addr, protocol):
    """ the actual handler for requestHandler-managed requests."""
    requestData, responseData, ctxt = None, None, {}
    # capture the socket address (ip & port, or path, for a unix
    # socket) on which the request came, for scoping of configuration
    # data on their basis
    ip, port, unixpath = None, None, None
    try:
        addr = sock.getsockname()
コード例 #5
0
import signal
import socket
import errno

# create standard logging methods
loginit(make_all=False)

__all__=['HandleRequest',
         'PostResponse',
         'RequestFailed',
         'addRequestHandler',
         'DocumentTimeout',
         'ClientProtocol']

mergeDefaults(DocumentTimeout=30,
              PostResponseTimeout=20,
              jobs=())

# hooks
HandleRequest=Hook()
PostResponse=Hook()


def processRequest(sock, addr, protocol):
    """ the actual handler for requestHandler-managed requests."""
    requestData, responseData, ctxt=None, None, {}
    # capture the socket address (ip & port, or path, for a unix
    # socket) on which the request came, for scoping of configuration
    # data on their basis
    ip, port, unixpath=None, None, None
    try:      
コード例 #6
0
from skunk.web.config import mergeDefaults
from skunk.util.hooks import Hook
from skunk.util.gziputil import TimelessGzipFile
from skunk.web.util.status import http_statuses, headersonlyStatuses

mergeDefaults(textCompression=False,
              generateEtagHeader=True,
              HttpLoggingOn=False)

headersOnlyMethods = ('HEAD', )

# hooks declared here
HaveConnection = Hook()
PreHandleConnection = Hook()
HandleConnection = Hook()
ProcessResponse = Hook()


class Redirect(Exception):
    pass


class NullOutput:
    def write(self, *args):
        pass

    def getvalue(self):
        return ''


def _processRequest(requestData, ctxt):