Changeset aef164a for server/lib/gutenbach/server/server.py
- Timestamp:
- Dec 20, 2011, 3:24:01 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 5e44432
- Parents:
- 59a1d4a
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 15:24:01)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 15:24:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/server.py
ref8df33 raef164a 3 3 import gutenbach.ipp as ipp 4 4 import logging 5 import sys 5 6 import traceback 6 import sys7 7 8 8 # initialize logger … … 27 27 length = int(self.headers.getheader('content-length', 0)) 28 28 request = ipp.Request(request=self.rfile, length=length) 29 logger.debug("Received request: %s" % repr(request))30 29 31 30 # Get the handler and pass it the request and response 32 31 # objects. It will fill in values for the response object or 33 # thrown an error. 32 # throw a fatal error. 33 logger.debug("Received request: %s" % repr(request)) 34 34 try: 35 35 response = self.root.handle(request) 36 37 # Handle any errors that occur. If an exception occurs that 38 # is an IPP error, then we can get the error code from the 39 # exception itself. 40 except ipp.errors.IPPException: 41 exctype, excval, exctb = sys.exc_info() 42 logger.error(traceback.format_exc()) 43 response = ipp.ops.make_empty_response(request) 44 excval.update_response(response) 45 46 # If it wasn't an IPP error, then it's our fault, so mark it 47 # as an internal server error 48 except Exception: 49 logger.error(traceback.format_exc()) 50 response = ipp.ops.make_empty_response(request) 51 response.operation_id = ipp.StatusCodes.INTERNAL_ERROR 36 except: 37 logger.fatal(traceback.format_exc()) 38 sys.exit(1) 52 39 53 40 # Send the response across HTTP
Note: See TracChangeset
for help on using the changeset viewer.