Changeset aef164a for server/lib/gutenbach/server/requests.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/requests.py
r59a1d4a raef164a 1 1 from gutenbach.server.printer import GutenbachPrinter 2 2 import gutenbach.ipp as ipp 3 import gutenbach.ipp.constants as const 3 import gutenbach.ipp.constants as consts 4 4 import logging 5 5 … … 41 41 handler = getattr(self, handler_name) 42 42 logger.info("Handling request of type '%s'" % handler_name) 43 response = handler(request) 43 44 # Try to handle the request 45 try: 46 response = handler(request) 47 48 # Handle any errors that occur. If an exception occurs that 49 # is an IPP error, then we can get the error code from the 50 # exception itself. 51 except ipp.errors.IPPException: 52 exctype, excval, exctb = sys.exc_info() 53 logger.error(traceback.format_exc()) 54 response = ipp.ops.make_empty_response(request) 55 excval.update_response(response) 56 57 # If it wasn't an IPP error, then it's our fault, so mark it 58 # as an internal server error 59 except Exception: 60 logger.error(traceback.format_exc()) 61 response = ipp.ops.make_empty_response(request) 62 response.operation_id = ipp.StatusCodes.INTERNAL_ERROR 63 44 64 return response 45 65 … … 47 67 logger.warning("Received unknown operation 0x%x" % request.operation_id) 48 68 response = ipp.ops.make_empty_response(request) 49 response.operation_id = const .StatusCodes.OPERATION_NOT_SUPPORTED69 response.operation_id = consts.StatusCodes.OPERATION_NOT_SUPPORTED 50 70 return response 51 71 … … 58 78 pass 59 79 60 @handler_for(const .Operations.GET_JOBS)80 @handler_for(consts.Operations.GET_JOBS) 61 81 def get_jobs(self, request): 62 82 """RFC 2911: 3.2.6 Get-Jobs Operation … … 104 124 pass 105 125 106 @handler_for(const .Operations.GET_PRINTER_ATTRIBUTES)126 @handler_for(consts.Operations.GET_PRINTER_ATTRIBUTES) 107 127 def get_printer_attributes(self, request): 108 128 """RFC 2911: 3.2.5 Get-Printer-Attributes Operation … … 217 237 ##### CUPS Specific Commands 218 238 219 @handler_for(const .Operations.CUPS_GET_DEFAULT)239 @handler_for(consts.Operations.CUPS_GET_DEFAULT) 220 240 def cups_get_default(self, request): 221 241 """The CUPS-Get-Default operation (0x4001) returns the default … … 233 253 return response 234 254 235 @handler_for(const .Operations.CUPS_GET_PRINTERS)255 @handler_for(consts.Operations.CUPS_GET_PRINTERS) 236 256 def cups_get_printers(self, request): 237 257 """The CUPS-Get-Printers operation (0x4002) returns the … … 253 273 return response 254 274 255 @handler_for(const .Operations.CUPS_GET_CLASSES)275 @handler_for(consts.Operations.CUPS_GET_CLASSES) 256 276 def cups_get_classes(self, request): 257 277 """The CUPS-Get-Classes operation (0x4005) returns the printer
Note: See TracChangeset
for help on using the changeset viewer.