Example #1
0
from skunk.web.config import Configuration, mergeDefaults
from skunk.web.services.requestHandler import (ClientProtocol,
                                               RequestFailed,
                                               addRequestHandler)
from skunk.net.SocketScience import read_this_many
from skunk.util.logutil import loginit
import marshal

# log methods
loginit(make_all=False)

class AecgiProtocol(ClientProtocol):
    """
    protocol used to communicate with Apache via mod_skunkweb
    """
    
    def marshalRequest(self, sock, ctxt):
        """
        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
        """
        sock.sendall('\0')
        debug('sent sentinel')
        lenDataStr = read_this_many(sock, 10)
        debug('read length')
        lenData = int(lenDataStr)
        data = read_this_many(sock, lenData)
        debug('read request data')
        return marshal.loads(data)
Example #2
0
from skunk.util.logutil import loginit

loginit()

Example #3
0
  >>> c=CompileCache('/path/to/cacheroot', useMemory=True)
  >>> component=FileComponent(mypath, compileCache=c)

The cache can store compiled code on disk, in memory, or both.

"""

import os
import errno
import stat
import time
import marshal
normpath=os.path.normpath

from skunk.config import Configuration
from skunk.util.logutil import loginit; loginit()

def _mtime(path):
    try:
        s=os.stat(path)
    except OSError, e:
        if e.errno!=errno.ENOENT: 
           raise
        return None 
    else:
        return max(s[stat.ST_CTIME],
                   s[stat.ST_MTIME])

class _default(object): pass

class CompileCache(object):
Example #4
0
from skunk.util.logutil import loginit
loginit(all=True)