Changeset 5e44432
- Timestamp:
- Dec 20, 2011, 3:43:44 PM (13 years ago)
- Branches:
- no-cups
- Children:
- 9d9bc15
- Parents:
- aef164a
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 15:43:44)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 15:43:44)
- Location:
- server/lib/gutenbach
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/__init__.py
rdf51061 r5e44432 1 import ipp 2 import server 3 4 __all__ = ['ipp', 'server'] -
server/lib/gutenbach/ipp/__init__.py
rf6c6897 r5e44432 1 1 from attribute import Attribute 2 2 from attributegroup import AttributeGroup 3 from constants import Tags, StatusCodes 3 4 from request import Request 4 5 from value import Value 5 from constants import Tags, StatusCodes 6 import operations as ops 6 import constants 7 7 import exceptions as errors 8 8 9 # this import needs to come last 10 import operations as ops 11 9 12 __all__ = ['Attribute', 'AttributeGroup', 'Request', 'Value', 10 'Tags', 'StatusCodes', 'ops', 'errors' ]13 'Tags', 'StatusCodes', 'ops', 'errors', 'constants'] -
server/lib/gutenbach/ipp/operations.py
raef164a r5e44432 1 from .attribute import Attribute2 from .attributegroup import AttributeGroup3 from .request import Request4 from .value import Value5 import constants as consts6 import exceptions as err7 import logging8 9 logger = logging.getLogger(__name__)10 11 def verify_operations(request):12 """Pretty much all requests have the first attribute group for13 operation attributes, and these all have 'attributes-charset' and14 'attributes-natural-language' as the first two attributes. This15 method just generically verifies that these attributes are there.16 17 """18 19 # XXX: check version20 if False:21 raise err.VersionNotSupported(str(request.version))22 23 # XXX: check operation id24 if False:25 raise err.OperationNotSupported(str(request.operation_id))26 27 # check operation attributes tag28 op_attrs = request.attribute_groups[0]29 if op_attrs.tag != consts.AttributeTags.OPERATION:30 raise err.BadRequest(31 "Attribute group does not have OPERATION tag: 0x%x" % op_attrs.tag)32 33 # XXX: if these aren't valid, then you HAVE to return something34 # special. See RFC 2911 3.1.6.135 # # check compression36 # if False:37 # raise err.CompressionNotSupported38 39 # # check document format40 # if False:41 # raise err.DocumentFormatNotSupported42 43 # # check document uri44 # if False:45 # raise err.UriSchemeNotSupported46 47 # check charset48 charset_attr = op_attrs.attributes[0]49 if charset_attr.name != 'attributes-charset':50 raise err.BadRequest(51 "Attribute is not attributes-charset: %s" % charset_attr.name)52 if len(charset_attr.values) != 1:53 raise err.BadRequest(54 "Too many values for attributes-charset: %d" % len(charset_attr.values))55 # check charset value56 charset_value = charset_attr.values[0]57 if charset_value.tag != consts.operations_attribute_value_tags['attributes-charset']:58 raise err.BadRequest(59 "Wrong tag for charset value: 0x%x" % charset_value.tag)60 if charset_value.value != 'utf-8':61 raise err.CharsetNotSupported(str(charset_value.value))62 63 # check for attributes-natural-language64 natlang_attr = op_attrs.attributes[1]65 if natlang_attr.name != 'attributes-natural-language':66 raise err.BadRequest(67 "Attribute is not attributes-natural-language: %s" % natlang_attr.name)68 if len(charset_attr.values) != 1:69 raise err.BadRequest(70 "Too many values for attributes-natural-language: %s" % len(natlang_attr.values))71 # check natural language value72 natlang_value = natlang_attr.values[0]73 if natlang_value.tag != consts.operations_attribute_value_tags['attributes-natural-language']:74 raise err.BadRequest(75 "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" % natlang_value.tag)76 if natlang_value.value != 'en-us':77 raise err.Attributes(78 "Invalid natural language value: %s" % natlang_value.value, [natlang_attr])79 80 return dict([(attr.name, attr.values) for attr in op_attrs.attributes])81 82 def verify_printer_uri(values):83 if len(values) != 1:84 raise err.BadRequest(85 "Requesting printer uri attribute has too many values: %d" % len(values))86 uri_value = values[0]87 if uri_value.tag != consts.operations_attribute_value_tags['printer-uri']:88 raise err.BadRequest(89 "Bad value tag (expected URI): 0x%x" % uri_value_tag)90 91 # actually get the printer name92 # XXX: hack -- CUPS will strip the port from the request, so93 # we can't do an exact comparison (also the hostname might be94 # different, depending on the CNAME or whether it's localhost)95 uri = uri_value.value.split("/")[-1]96 return uri97 98 def verify_requesting_username(values):99 if len(values) != 1:100 raise err.BadRequest(101 "Requesting user name attribute has too many values: %d" % len(values))102 requser_value = values[0]103 if requser_value.tag != consts.operations_attribute_value_tags['requesting-user-name']:104 raise err.BadRequest(105 "Bad value tag (expected NAME_WITHOUT_LANGUAGE): 0x%x" % requser_value.tag)106 107 return requser_value.value108 109 def make_empty_response(request):110 # Operation attributes -- typically the same for any request111 attributes = [112 Attribute(113 'attributes-charset',114 [Value(consts.operations_attribute_value_tags['attributes-charset'], 'utf-8')]),115 Attribute(116 'attributes-natural-language',117 [Value(consts.operations_attribute_value_tags['attributes-natural-language'],118 'en-us')])119 ]120 # Put the operation attributes in a group121 attribute_group = AttributeGroup(122 consts.AttributeTags.OPERATION,123 attributes)124 125 # Set up the default response -- handlers will override these126 # values if they need to127 response_kwargs = {}128 response_kwargs['version'] = request.version129 response_kwargs['operation_id'] = consts.StatusCodes.OK130 response_kwargs['request_id'] = request.request_id131 response_kwargs['attribute_groups'] = [attribute_group]132 response = Request(**response_kwargs)133 134 return response135 136 def make_job_attributes(attrs, request, response):137 ipp_attrs = []138 for attr, vals in attrs:139 ipp_vals = [Value(140 tag=consts.job_attribute_value_tags[attr],141 value=val) for val in vals]142 ipp_attrs.append(Attribute(name=attr, values=ipp_vals))143 response.attribute_groups.append(AttributeGroup(144 consts.AttributeTags.JOB, ipp_attrs))145 146 def make_printer_attributes(attrs, request, response):147 ipp_attrs = []148 for attr, vals in attrs:149 ipp_vals = [Value(150 tag=consts.printer_attribute_value_tags[attr],151 value=val) for val in vals]152 ipp_attrs.append(Attribute(name=attr, values=ipp_vals))153 response.attribute_groups.append(AttributeGroup(154 consts.AttributeTags.PRINTER, ipp_attrs))155 156 #### GET-JOBS157 158 def verify_get_jobs_request(request):159 """RFC 2911 3.2.6.1 Get-Jobs Request160 161 The client submits the Get-Jobs request to a Printer object.162 163 The following groups of attributes are part of the Get-Jobs164 Request:165 166 Group 1: Operation Attributes167 Natural Language and Character Set:168 The 'attributes-charset' and169 'attributes-natural-language' attributes as described170 in section 3.1.4.1.171 Target:172 The 'printer-uri' (uri) operation attribute which is173 the target for this operation as described in section174 3.1.5.175 Requesting User Name:176 The 'requesting-user-name' (name(MAX)) attribute177 SHOULD be supplied by the client as described in178 section 8.3.179 'limit' (integer(1:MAX)):180 The client OPTIONALLY supplies this attribute. The181 Printer object MUST support this attribute. It is an182 integer value that determines the maximum number of183 jobs that a client will receive from the Printer even184 if 'which-jobs' or 'my-jobs' constrain which jobs are185 returned. The limit is a 'stateless limit' in that if186 the value supplied by the client is 'N', then only the187 first 'N' jobs are returned in the Get-Jobs Response.188 There is no mechanism to allow for the next 'M' jobs189 after the first 'N' jobs. If the client does not190 supply this attribute, the Printer object responds191 with all applicable jobs.192 'requested-attributes' (1setOf type2 keyword):193 The client OPTIONALLY supplies this attribute. The194 Printer object MUST support this attribute. It is a195 set of Job attribute names and/or attribute groups196 names in whose values the requester is197 interested. This set of attributes is returned for198 each Job object that is returned. The allowed199 attribute group names are the same as those defined in200 the Get-Job-Attributes operation in section 3.3.4. If201 the client does not supply this attribute, the Printer202 MUST respond as if the client had supplied this203 attribute with two values: 'job-uri' and 'job-id'.204 'which-jobs' (type2 keyword):205 The client OPTIONALLY supplies this attribute. The206 Printer object MUST support this attribute. It207 indicates which Job objects MUST be returned by the208 Printer object. The values for this attribute are:209 - 'completed': This includes any Job object whose210 state is 'completed', 'canceled', or 'aborted'.211 - 'not-completed': This includes any Job object whose212 state is 'pending', 'processing',213 'processing-stopped', or 'pending-held'.214 A Printer object MUST support both values. However, if215 the implementation does not keep jobs in the216 'completed', 'canceled', and 'aborted' states, then it217 returns no jobs when the 'completed' value is218 supplied. If a client supplies some other value, the219 Printer object MUST copy the attribute and the220 unsupported value to the Unsupported Attributes221 response group, reject the request, and return the222 'client-error-attributes-or-values-not-supported'223 status code. If the client does not supply this224 attribute, the Printer object MUST respond as if the225 client had supplied the attribute with a value of226 'not-completed'.227 'my-jobs' (boolean):228 The client OPTIONALLY supplies this attribute. The229 Printer object MUST support this attribute. It230 indicates whether jobs from all users or just the jobs231 submitted by the requesting user of this request MUST232 be considered as candidate jobs to be returned by the233 Printer object. If the client does not supply this234 attribute, the Printer object MUST respond as if the235 client had supplied the attribute with a value of236 'false', i.e., jobs from all users. The means for237 authenticating the requesting user and matching the238 jobs is described in section 8.239 240 """241 242 out = {}243 244 # generic operations verification245 attrs = verify_operations(request)246 247 # requested printer uri248 if 'printer-uri' not in attrs:249 raise err.BadRequest("Missing 'printer-uri' attribute")250 out['printer-uri'] = verify_printer_uri(attrs['printer-uri'])251 252 # requesting username253 if 'requesting-user-name' not in attrs:254 logger.warning("Missing 'requesting-user-name' attribute")255 else:256 out['requesting-user-name'] = verify_requesting_username(attrs['requesting-user-name'])257 258 if 'limit' in attrs:259 out['limit'] = None # XXX260 261 if 'requested-attributes' in attrs:262 out['requested-attributes'] = None # XXX263 264 if 'which-jobs' in attrs:265 out['which-jobs'] = None # XXX266 267 if 'my-jobs' in attrs:268 out['my-jobs'] = None # XXX269 270 return out271 272 def make_get_jobs_response(jobs, request):273 """RFC 2911: 3.2.6.2 Get-Jobs Response274 275 The Printer object returns all of the Job objects up to the number276 specified by the 'limit' attribute that match the criteria as277 defined by the attribute values supplied by the client in the278 request. It is possible that no Job objects are returned since279 there may literally be no Job objects at the Printer, or there may280 be no Job objects that match the criteria supplied by the281 client. If the client requests any Job attributes at all, there is282 a set of Job Object Attributes returned for each Job object.283 284 It is not an error for the Printer to return 0 jobs. If the285 response returns 0 jobs because there are no jobs matching the286 criteria, and the request would have returned 1 or more jobs287 with a status code of 'successful-ok' if there had been jobs288 matching the criteria, then the status code for 0 jobs MUST be289 'successful-ok'.290 291 Group 1: Operation Attributes292 Status Message:293 In addition to the REQUIRED status code returned in294 every response, the response OPTIONALLY includes a295 'status-message' (text(255)) and/or a296 'detailed-status-message' (text(MAX)) operation297 attribute as described in sections 13 and 3.1.6.298 Natural Language and Character Set:299 The 'attributes-charset' and300 'attributes-natural-language' attributes as described301 in section 3.1.4.2.302 303 Group 2: Unsupported Attributes304 See section 3.1.7 for details on returning Unsupported305 Attributes. The response NEED NOT contain the306 'requested-attributes' operation attribute with any307 supplied values (attribute keywords) that were requested308 by the client but are not supported by the IPP object. If309 the Printer object does return unsupported attributes310 referenced in the 'requested-attributes' operation311 attribute and that attribute included group names, such as312 'all', the unsupported attributes MUST NOT include313 attributes described in the standard but not supported by314 the implementation.315 316 Groups 3 to N: Job Object Attributes317 The Printer object responds with one set of Job Object318 Attributes for each returned Job object. The Printer319 object ignores (does not respond with) any requested320 attribute or value which is not supported or which is321 restricted by the security policy in force, including322 whether the requesting user is the user that submitted the323 job (job originating user) or not (see section324 8). However, the Printer object MUST respond with the325 'unknown' value for any supported attribute (including all326 REQUIRED attributes) for which the Printer object does not327 know the value, unless it would violate the security328 policy. See the description of the 'out-of- band' values329 in the beginning of Section 4.1.330 331 Jobs are returned in the following order:332 - If the client requests all 'completed' Jobs (Jobs in the333 'completed', 'aborted', or 'canceled' states), then the334 Jobs are returned newest to oldest (with respect to335 actual completion time)336 - If the client requests all 'not-completed' Jobs (Jobs in337 the 'pending', 'processing', 'pending-held', and338 'processing- stopped' states), then Jobs are returned in339 relative chronological order of expected time to340 complete (based on whatever scheduling algorithm is341 configured for the Printer object).342 343 """344 345 response = make_empty_response(request)346 # XXX: we need to honor the things that the request actually asks for347 for job in jobs:348 make_job_attributes(job, request, response)349 return response350 351 ## GET-PRINTER-ATTRIBUTES352 353 def verify_get_printer_attributes_request(request):354 """RFC 2911: 3.2.5.1 Get-Printer-Attributes Request355 356 The following sets of attributes are part of the Get-Printer-357 Attributes Request:358 359 Group 1: Operation Attributes360 Natural Language and Character Set:361 The 'attributes-charset' and 'attributes-natural-language'362 attributes as described in section 3.1.4.1.363 Target:364 The 'printer-uri' (uri) operation attribute which is the365 target for this operation as described in section 3.1.5.366 Requesting User Name:367 The 'requesting-user-name' (name(MAX)) attribute SHOULD be368 supplied by the client as described in section 8.3.369 'requested-attributes' (1setOf keyword):370 The client OPTIONALLY supplies a set of attribute names371 and/or attribute group names in whose values the requester372 is interested. The Printer object MUST support this373 attribute. If the client omits this attribute, the374 Printer MUST respond as if this attribute had been375 supplied with a value of 'all'.376 'document-format' (mimeMediaType):377 The client OPTIONALLY supplies this attribute. The Printer378 object MUST support this attribute. This attribute is379 useful for a Printer object to determine the set of380 supported attribute values that relate to the requested381 document format. The Printer object MUST return the382 attributes and values that it uses to validate a job on a383 create or Validate-Job operation in which this document384 format is supplied. The Printer object SHOULD return only385 (1) those attributes that are supported for the specified386 format and (2) the attribute values that are supported for387 the specified document format. By specifying the document388 format, the client can get the Printer object to eliminate389 the attributes and values that are not supported for a390 specific document format. For example, a Printer object391 might have multiple interpreters to support both392 'application/postscript' (for PostScript) and 'text/plain'393 (for text) documents. However, for only one of those394 interpreters might the Printer object be able to support395 'number-up' with values of '1', '2', and '4'. For the396 other interpreter it might be able to only support397 'number-up' with a value of '1'. Thus a client can use398 the Get-Printer-Attributes operation to obtain the399 attributes and values that will be used to accept/reject a400 create job operation.401 402 If the Printer object does not distinguish between403 different sets of supported values for each different404 document format when validating jobs in the create and405 Validate-Job operations, it MUST NOT distinguish between406 different document formats in the Get-Printer-Attributes407 operation. If the Printer object does distinguish between408 different sets of supported values for each different409 document format specified by the client, this410 specialization applies only to the following Printer411 object attributes:412 413 - Printer attributes that are Job Template attributes414 ('xxx- default' 'xxx-supported', and 'xxx-ready' in the415 Table in Section 4.2),416 417 - 'pdl-override-supported',418 - 'compression-supported',419 - 'job-k-octets-supported',420 - 'job-impressions-supported',421 - 'job-media-sheets-supported',422 - 'printer-driver-installer',423 - 'color-supported', and424 - 'reference-uri-schemes-supported'425 426 The values of all other Printer object attributes427 (including 'document-format-supported') remain invariant428 with respect to the client supplied document format429 (except for new Printer description attribute as430 registered according to section 6.2).431 432 If the client omits this 'document-format' operation433 attribute, the Printer object MUST respond as if the434 attribute had been supplied with the value of the Printer435 object's 'document-format- default' attribute. It is436 RECOMMENDED that the client always supply a value for437 'document-format', since the Printer object's438 'document-format-default' may be439 'application/octet-stream', in which case the returned440 attributes and values are for the union of the document441 formats that the Printer can automatically sense. For442 more details, see the description of the 'mimeMediaType'443 attribute syntax in section 4.1.9.444 445 If the client supplies a value for the 'document-format'446 Operation attribute that is not supported by the Printer,447 i.e., is not among the values of the Printer object's448 'document-format-supported' attribute, the Printer object449 MUST reject the operation and return the450 'client-error-document-format-not-supported' status code.451 452 """453 454 out = {}455 456 # generic operations verification457 attrs = verify_operations(request)458 459 # requested printer uri460 if 'printer-uri' not in attrs:461 raise err.BadRequest("Missing 'printer-uri' attribute")462 out['printer-uri'] = verify_printer_uri(attrs['printer-uri'])463 464 # requesting username465 if 'requesting-user-name' not in attrs:466 logger.warning("Missing 'requesting-user-name' attribute")467 else:468 out['requesting-user-name'] = verify_requesting_username(attrs['requesting-user-name'])469 470 if 'requested-attributes' in attrs:471 out['requested-attributes'] = None # XXX472 473 if 'document-format' in attrs:474 out['document-format'] = None # XXX475 476 return out477 478 def make_get_printer_attributes_response(attrs, request):479 """3.2.5.2 Get-Printer-Attributes Response480 481 The Printer object returns the following sets of attributes as482 part of the Get-Printer-Attributes Response:483 484 Group 1: Operation Attributes485 Status Message:486 In addition to the REQUIRED status code returned in every487 response, the response OPTIONALLY includes a488 'status-message' (text(255)) and/or a489 'detailed-status-message' (text(MAX)) operation attribute490 as described in sections 13 and 3.1.6.491 Natural Language and Character Set:492 The 'attributes-charset' and 'attributes-natural-language'493 attributes as described in section 3.1.4.2.494 495 Group 2: Unsupported Attributes496 See section 3.1.7 for details on returning Unsupported497 Attributes. The response NEED NOT contain the498 'requested-attributes' operation attribute with any supplied499 values (attribute keywords) that were requested by the client500 but are not supported by the IPP object. If the Printer501 object does return unsupported attributes referenced in the502 'requested-attributes' operation attribute and that attribute503 included group names, such as 'all', the unsupported504 attributes MUST NOT include attributes described in the505 standard but not supported by the implementation.506 507 Group 3: Printer Object Attributes508 This is the set of requested attributes and their current509 values. The Printer object ignores (does not respond with)510 any requested attribute which is not supported. The Printer511 object MAY respond with a subset of the supported attributes512 and values, depending on the security policy in513 force. However, the Printer object MUST respond with the514 'unknown' value for any supported attribute (including all515 REQUIRED attributes) for which the Printer object does not516 know the value. Also the Printer object MUST respond with the517 'no-value' for any supported attribute (including all REQUIRED518 attributes) for which the system administrator has not519 configured a value. See the description of the 'out-of-band'520 values in the beginning of Section 4.1.521 522 """523 524 response = make_empty_response(request)525 make_printer_attributes(attrs, request, response)526 return response527 528 ### CUPS-GET-DEFAULT529 530 def verify_cups_get_default_request(request):531 """CUPS-Get-Default Request532 533 The following groups of attributes are supplied as part of the534 CUPS-Get-Default request:535 536 Group 1: Operation Attributes537 Natural Language and Character Set:538 The 'attributes-charset' and539 'attributes-natural-language' attributes as described540 in section 3.1.4.1 of the IPP Model and Semantics541 document.542 'requested-attributes' (1setOf keyword):543 The client OPTIONALLY supplies a set of attribute544 names and/or attribute group names in whose values the545 requester is interested. If the client omits this546 attribute, the server responds as if this attribute547 had been supplied with a value of 'all'.548 549 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_DEFAULT )550 551 """552 553 return {}554 555 def make_cups_get_default_response(attrs, request):556 """CUPS-Get-Default Response557 558 The following groups of attributes are send as part of the559 CUPS-Get-Default Response:560 561 Group 1: Operation Attributes562 Status Message:563 The standard response status message.564 Natural Language and Character Set:565 The 'attributes-charset' and566 'attributes-natural-language' attributes as described567 in section 3.1.4.2 of the IPP Model and Semantics568 document.569 570 Group 2: Printer Object Attributes571 The set of requested attributes and their current values.572 573 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_DEFAULT )574 575 """576 577 response = make_empty_response(request)578 make_printer_attributes(attrs, request, response)579 return response580 581 ### CUPS-GET-PRINTERS582 583 def verify_cups_get_printers_request(request):584 """CUPS-Get-Printers Request585 586 The following groups of attributes are supplied as part of the587 CUPS-Get-Printers request:588 589 Group 1: Operation Attributes590 Natural Language and Character Set:591 The 'attributes-charset' and592 'attributes-natural-language' attributes as described593 in section 3.1.4.1 of the IPP Model and Semantics594 document.595 'first-printer-name' (name(127)):CUPS 1.2/Mac OS X 10.5596 The client OPTIONALLY supplies this attribute to597 select the first printer that is returned.598 'limit' (integer (1:MAX)):599 The client OPTIONALLY supplies this attribute limiting600 the number of printers that are returned.601 'printer-location' (text(127)): CUPS 1.1.7602 The client OPTIONALLY supplies this attribute to603 select which printers are returned.604 'printer-type' (type2 enum): CUPS 1.1.7605 The client OPTIONALLY supplies a printer type606 enumeration to select which printers are returned.607 'printer-type-mask' (type2 enum): CUPS 1.1.7608 The client OPTIONALLY supplies a printer type mask609 enumeration to select which bits are used in the610 'printer-type' attribute.611 'requested-attributes' (1setOf keyword) :612 The client OPTIONALLY supplies a set of attribute613 names and/or attribute group names in whose values the614 requester is interested. If the client omits this615 attribute, the server responds as if this attribute616 had been supplied with a value of 'all'.617 'requested-user-name' (name(127)) : CUPS 1.2/Mac OS X 10.5618 The client OPTIONALLY supplies a user name that is619 used to filter the returned printers.620 621 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS )622 623 """624 625 # XXX: actually do something here626 return {}627 628 def make_cups_get_printers_response(printers, request):629 """CUPS-Get-Printers Response630 631 The following groups of attributes are send as part of the632 CUPS-Get-Printers Response:633 634 Group 1: Operation Attributes635 Status Message:636 The standard response status message.637 Natural Language and Character Set:638 The 'attributes-charset' and639 'attributes-natural-language' attributes as described640 in section 3.1.4.2 of the IPP Model and Semantics641 document.642 643 Group 2: Printer Object Attributes644 The set of requested attributes and their current values645 for each printer.646 647 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS )648 649 """650 651 response = make_empty_response(request)652 for printer in printers:653 make_printer_attributes(printer, request, response)654 return response655 656 ### CUPS-GET-CLASSES657 658 def verify_cups_get_classes_request(request):659 """CUPS-Get-Classes Request660 661 The following groups of attributes are supplied as part of the662 CUPS-Get-Classes request:663 664 Group 1: Operation Attributes665 Natural Language and Character Set:666 The 'attributes-charset' and667 'attributes-natural-language' attributes as described668 in section 3.1.4.1 of the IPP Model and Semantics669 document.670 'first-printer-name' (name(127)):CUPS 1.2/Mac OS X 10.5671 The client OPTIONALLY supplies this attribute to672 select the first printer that is returned.673 'limit' (integer (1:MAX)):674 The client OPTIONALLY supplies this attribute limiting675 the number of printer classes that are returned.676 'printer-location' (text(127)): CUPS 1.1.7677 The client OPTIONALLY supplies this attribute to678 select which printer classes are returned.679 'printer-type' (type2 enum): CUPS 1.1.7680 The client OPTIONALLY supplies a printer type681 enumeration to select which printer classes are682 returned.683 'printer-type-mask' (type2 enum): CUPS 1.1.7684 The client OPTIONALLY supplies a printer type mask685 enumeration to select which bits are used in the686 'printer-type' attribute.687 'requested-attributes' (1setOf keyword) :688 The client OPTIONALLY supplies a set of attribute689 names and/or attribute group names in whose values the690 requester is interested. If the client omits this691 attribute, the server responds as if this attribute692 had been supplied with a value of 'all'.693 'requested-user-name' (name(127)) : CUPS 1.2/Mac OS X 10.5694 The client OPTIONALLY supplies a user name that is695 used to filter the returned printers.696 697 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_CLASSES )698 699 """700 701 # XXX: actually do something here702 return {}703 704 def make_cups_get_classes_response(request):705 """CUPS-Get-Classes Response706 707 The following groups of attributes are send as part of the708 CUPS-Get-Classes Response:709 710 Group 1: Operation Attributes711 Status Message:712 The standard response status message.713 Natural Language and Character Set:714 The 'attributes-charset' and715 'attributes-natural-language' attributes as described716 in section 3.1.4.2 of the IPP Model and Semantics717 document.718 719 Group 2: Printer Class Object Attributes720 The set of requested attributes and their current values721 for each printer class.722 723 (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_CLASSES )724 725 """726 727 response = make_empty_response(request)728 return response -
server/lib/gutenbach/server/requests.py
raef164a r5e44432 3 3 import gutenbach.ipp.constants as consts 4 4 import logging 5 import traceback 5 6 6 7 # initialize logger
Note: See TracChangeset
for help on using the changeset viewer.