def __initHooks(): from web.protocol import HandleConnection HandleConnection.addFunction(doUserDirPre, "*", 0) import requestHandler.requestHandler as rh rh.EndSession.addFunction(doUserDirPost)
def __initHooks(): import SkunkWeb.constants as skc import Handler from web.protocol import HandleConnection from requestHandler.protocol import RequestFailed jobGlob=skc.TEMPLATING_JOB+'*' HandleConnection.addFunction(Handler.requestHandler, jobGlob) HandleConnection.addFunction(Handler.plainHandler, jobGlob) HandleConnection.addFunction(Handler.fourOhFourHandler, jobGlob) RequestFailed.addFunction(_formatException, jobGlob)
def __initHooks(): import SkunkWeb.constants as skc #TEMPORARILY HARD-CODED in SkunkWeb.constants.py -- FIX NE *** #rc.TEMPLATING_JOB= rc.WEB_JOB + rc.AE_COMPONENT_JOB + '/templating/' import Handler from web.protocol import HandleConnection from aecgi import RequestFailed jobGlob=skc.TEMPLATING_JOB+'*' HandleConnection.addFunction(Handler.requestHandler, jobGlob) HandleConnection.addFunction(Handler.plainHandler, jobGlob) HandleConnection.addFunction(Handler.fourOhFourHandler, jobGlob) RequestFailed.addFunction(_formatException, jobGlob)
except PreemptiveResponse: # not a problem, raise it raise except Response, res: res(connection) return connection.response() except: # OK, something bad. This should be a server error. return _handleException(connection) else: if res: if isinstance(res, basestring): connection.write(res) elif callable(res): res(connection) else: # an iterable, hopefully for thing in res: connection.write(thing) return connection.response() glob='%s*' % WEB_JOB # go *before* the templating handlers HandleConnection.addFunction(controllerHandler, glob, 0)
# some defaults connection.setStatus(200) connection.setContentType('text/html') try: res = meth(**data) except PreemptiveResponse: # not a problem, raise it raise except Response: res(connection) return connection.response() except: # OK, something bad. This should be a server error. return _handleException(connection) else: if res: if isinstance(res, basestring): connection.write(res) elif callable(res): res(connection) else: # an iterable, hopefully for thing in res: connection.write(thing) return connection.response() glob = '%s*' % WEB_JOB # go *before* the templating handlers HandleConnection.addFunction(controllerHandler, glob, 0)
def __initHooks(): from web.protocol import HandleConnection HandleConnection.addFunction(doUserDirPre, '*', 0) import requestHandler.requestHandler as rh rh.EndSession.addFunction(doUserDirPost)