Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
 def marshalException(self, exc_text, sessionDict):
     '''
     should return response data appropriate for the current exception.
     '''
     res = RequestFailed(Configuration.job, exc_text, sessionDict)
     if res:
         return self._marshalData(res)
     else:
         return self._marshalData(exc_text)
Пример #4
0
 def marshalException(self, exc_text, sessionDict):
     res=RequestFailed(constants.WEB_JOB, exc_text, sessionDict)
     if res:
         return res
     else:
         # dummy up a 500. 
         httpVersion=sessionDict.get(constants.HTTP_VERSION, '')
         return '\r\n'.join([('%s 500 Internal Server Error' % httpVersion).strip(),
                             'Content-Type: text/plain',
                             'Content-Length: %d' % len(exc_text),
                             '',
                             exc_text])