source: server/lib/gutenbach/ipp/object_attributes/job_template_attributes.py @ b828a96

no-cups
Last change on this file since b828a96 was b828a96, checked in by Jessica B. Hamrick <jhamrick@…>, 12 years ago

Use classes for standard IPP attributes

  • Property mode set to 100644
File size: 4.3 KB
Line 
1__all__ = [
2    'JobPriority',
3    'JobHoldUntil',
4    'JobSheets',
5    'MultipleDocumentHandling',
6    'Copies',
7    'Finishings',
8    'PageRanges',
9    'Sides',
10    'NumberUp',
11    'OrientationRequested',
12    'Media',
13    'PrinterResolution',
14    'PrintQuality',
15]
16
17from ..attribute import Attribute
18from ..value import Value
19from ..exceptions import ClientErrorAttributes
20
21def JobPriority(val):
22    """4.2.1 job-priority (integer(1:100))
23
24    This attribute specifies a priority for scheduling the Job. A
25    higher value specifies a higher priority. The value 1 indicates
26    the lowest possible priority. The value 100 indicates the highest
27    possible priority. Among those jobs that are ready to print, a
28    Printer MUST print all jobs with a priority value of n before
29    printing those with a priority value of n-1 for all n.
30
31    If the Printer object supports this attribute, it MUST always
32    support the full range from 1 to 100. No administrative
33    restrictions are permitted. This way an end-user can always make
34    full use of the entire range with any Printer object. If
35    privileged jobs are implemented outside IPP/1.1, they MUST have
36    priorities higher than 100, rather than restricting the range
37    available to end-users.
38
39    If the client does not supply this attribute and this attribute is
40    supported by the Printer object, the Printer object MUST use the
41    value of the Printer object's 'job-priority-default' at job
42    submission time (unlike most Job Template attributes that are used
43    if necessary at job processing time).
44   
45    The syntax for the 'job-priority-supported' is also
46    integer(1:100).  This single integer value indicates the number of
47    priority levels supported. The Printer object MUST take the value
48    supplied by the client and map it to the closest integer in a
49    sequence of n integers values that are evenly distributed over the
50    range from 1 to 100 using the formula:
51
52        roundToNearestInt((100x+50)/n)
53
54    where n is the value of 'job-priority-supported' and x ranges from
55    0 through n-1.
56
57    For example, if n=1 the sequence of values is 50; if n=2, the
58    sequence of values is: 25 and 75; if n = 3, the sequence of values
59    is: 17, 50 and 83; if n = 10, the sequence of values is: 5, 15,
60    25, 35, 45, 55, 65, 75, 85, and 95; if n = 100, the sequence of
61    values is: 1, 2, 3, ... 100.
62
63    If the value of the Printer object's 'job-priority-supported' is
64    10 and the client supplies values in the range 1 to 10, the
65    Printer object maps them to 5, in the range 11 to 20, the Printer
66    object maps them to 15, etc.
67
68    """
69   
70   
71    return Attribute(
72        'job-priority',
73        [Value(IntegerTags.INTEGER), val])
74
75def JobHoldUntil(val):
76    """4.2.2 job-hold-until (type3 keyword | name (MAX))
77   
78    """
79
80    raise ClientErrorAttributes, "job-hold-until"
81   
82def JobSheets(val):
83    """4.2.3 job-sheets (type3 keyword | name(MAX))
84
85    """
86   
87    raise ClientErrorAttributes, "job-sheets"
88
89def MultipleDocumentHandling(val):
90    """4.2.4 multiple-document-handling (type2 keyword)
91
92    """
93
94    raise ClientErrorAttributes, "multiple-document-handling"
95
96def Copies(val):
97    """4.2.5 copies (integer(1:MAX))
98
99    """
100   
101    raise ClientErrorAttributes, "copies"
102
103def Finishings(*vals):
104    """4.2.6 finishings (1setOf type2 enum)
105
106    """
107
108    raise ClientErrorAttributes, "finishings"
109
110def PageRanges(*vals):
111    """4.2.7 page-ranges (1setOf rangeOfInteger (1:MAX))
112
113    """
114
115    raise ClientErrorAttributes, "page-ranges"
116
117def Sides(val):
118    """4.2.8 sides (type2 keyword)
119
120    """
121
122    raise ClientErrorAttributes, "sides"
123
124def NumberUp(val):
125    """4.2.9 number-up (integer(1:MAX))
126
127    """
128
129    raise ClientErrorAttributes, "number-up"
130
131def OrientationRequested(val):
132    """4.2.10 orientation-requested (type2 enum)
133
134    """
135
136    raise ClientErrorAttributes, "orientation-requested"
137
138def Media(val):
139    """4.2.11 media (type3 keyword | name(MAX))
140
141    """
142
143    raise ClientErrorAttributes, "media"
144
145### XXX: we may want to repurpose this for bitrate?
146def PrinterResolution(val):
147    """4.2.12 printer-resolution (resolution)
148
149    """
150
151    raise ClientErrorAttributes, "printer-resolution"
152
153def PrintQuality(val):
154    """4.2.13 print-quality (type2 enum)
155
156    """
157
158    raise ClientErrorAttributes, "print-quality"
Note: See TracBrowser for help on using the repository browser.