[5e44432] | 1 | from . import verify_operations |
---|
| 2 | from . import make_empty_response |
---|
| 3 | from . import make_printer_attributes |
---|
| 4 | |
---|
| 5 | import logging |
---|
| 6 | logger = logging.getLogger(__name__) |
---|
| 7 | |
---|
| 8 | def verify_cups_get_printers_request(request): |
---|
| 9 | """CUPS-Get-Printers Request |
---|
| 10 | |
---|
| 11 | The following groups of attributes are supplied as part of the |
---|
| 12 | CUPS-Get-Printers request: |
---|
| 13 | |
---|
| 14 | Group 1: Operation Attributes |
---|
| 15 | Natural Language and Character Set: |
---|
| 16 | The 'attributes-charset' and |
---|
| 17 | 'attributes-natural-language' attributes as described |
---|
| 18 | in section 3.1.4.1 of the IPP Model and Semantics |
---|
| 19 | document. |
---|
| 20 | 'first-printer-name' (name(127)):CUPS 1.2/Mac OS X 10.5 |
---|
| 21 | The client OPTIONALLY supplies this attribute to |
---|
| 22 | select the first printer that is returned. |
---|
| 23 | 'limit' (integer (1:MAX)): |
---|
| 24 | The client OPTIONALLY supplies this attribute limiting |
---|
| 25 | the number of printers that are returned. |
---|
| 26 | 'printer-location' (text(127)): CUPS 1.1.7 |
---|
| 27 | The client OPTIONALLY supplies this attribute to |
---|
| 28 | select which printers are returned. |
---|
| 29 | 'printer-type' (type2 enum): CUPS 1.1.7 |
---|
| 30 | The client OPTIONALLY supplies a printer type |
---|
| 31 | enumeration to select which printers are returned. |
---|
| 32 | 'printer-type-mask' (type2 enum): CUPS 1.1.7 |
---|
| 33 | The client OPTIONALLY supplies a printer type mask |
---|
| 34 | enumeration to select which bits are used in the |
---|
| 35 | 'printer-type' attribute. |
---|
| 36 | 'requested-attributes' (1setOf keyword) : |
---|
| 37 | The client OPTIONALLY supplies a set of attribute |
---|
| 38 | names and/or attribute group names in whose values the |
---|
| 39 | requester is interested. If the client omits this |
---|
| 40 | attribute, the server responds as if this attribute |
---|
| 41 | had been supplied with a value of 'all'. |
---|
| 42 | 'requested-user-name' (name(127)) : CUPS 1.2/Mac OS X 10.5 |
---|
| 43 | The client OPTIONALLY supplies a user name that is |
---|
| 44 | used to filter the returned printers. |
---|
| 45 | |
---|
| 46 | (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS ) |
---|
| 47 | |
---|
| 48 | """ |
---|
| 49 | |
---|
| 50 | # XXX: actually do something here |
---|
| 51 | return {} |
---|
| 52 | |
---|
| 53 | def make_cups_get_printers_response(printers, request): |
---|
| 54 | """CUPS-Get-Printers Response |
---|
| 55 | |
---|
| 56 | The following groups of attributes are send as part of the |
---|
| 57 | CUPS-Get-Printers Response: |
---|
| 58 | |
---|
| 59 | Group 1: Operation Attributes |
---|
| 60 | Status Message: |
---|
| 61 | The standard response status message. |
---|
| 62 | Natural Language and Character Set: |
---|
| 63 | The 'attributes-charset' and |
---|
| 64 | 'attributes-natural-language' attributes as described |
---|
| 65 | in section 3.1.4.2 of the IPP Model and Semantics |
---|
| 66 | document. |
---|
| 67 | |
---|
| 68 | Group 2: Printer Object Attributes |
---|
| 69 | The set of requested attributes and their current values |
---|
| 70 | for each printer. |
---|
| 71 | |
---|
| 72 | (Source: http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS ) |
---|
| 73 | |
---|
| 74 | """ |
---|
| 75 | |
---|
| 76 | response = make_empty_response(request) |
---|
| 77 | for printer in printers: |
---|
| 78 | make_printer_attributes(printer, request, response) |
---|
| 79 | return response |
---|