source: server/lib/gutenbach/ipp/object_attributes/job_description_attributes.py @ aded2d1

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

Checkpoint, creating classes for specific IPP attributes

  • Property mode set to 100644
File size: 16.9 KB
Line 
1__all__ = [
2    'JobUri',
3    'JobId',
4    'JobPrinterUri',
5    'JobMoreInfo',
6    'JobName',
7    'JobOriginatingUserName',
8    'JobState',
9    'JobStateReasons',
10    'JobStateMessage',
11    'JobDetailedStatusMessages',
12    'JobDocumentAccessErrors',
13    'NumberOfDocuments',
14    'OutputDeviceAssigned',
15    'TimeAtCreation',
16    'TimeAtProcessing',
17    'TimeAtCompleted',
18    'JobPrinterUpTime',
19    'DateTimeAtCreation',
20    'DateTimeAtProcessing',
21    'DateTimeAtCompletion',
22    'NumberOfInterveningJobs',
23    'JobMessageFromOperator',
24    'JobKOctets',
25    'JobImpressions',
26    'JobMediaSheets',
27    'JobKOctetsProcessed',
28    'JobImpressionsCompleted',
29    'JobMediaSheetsCompleted',
30    'AttributesCharset',
31    'AttributesNaturalLanguage',
32]
33
34from ..attribute import Attribute
35from ..value import Value
36from ..exceptions import ClientErrorAttributes
37from ..constants import *
38
39class JobUri(Attribute):
40    """4.3.1 job-uri (uri)
41
42    This REQUIRED attribute contains the URI for the job. The Printer
43    object, on receipt of a new job, generates a URI which identifies the
44    new Job. The Printer object returns the value of the 'job-uri'
45    attribute as part of the response to a create request. The precise
46    format of a Job URI is implementation dependent. If the Printer
47    object supports more than one URI and there is some relationship
48    between the newly formed Job URI and the Printer object's URI, the
49    Printer object uses the Printer URI supplied by the client in the
50    create request. For example, if the create request comes in over a
51    secure channel, the new Job URI MUST use the same secure channel.
52    This can be guaranteed because the Printer object is responsible for
53    generating the Job URI and the Printer object is aware of its
54    security configuration and policy as well as the Printer URI used in
55    the create request.
56
57    For a description of this attribute and its relationship to 'job-id'
58    and 'job-printer-uri' attribute, see the discussion in section 2.4 on
59    'Object Identity'.
60
61    """
62
63    def __init__(self, val):
64        super(type(self), self).__init__(
65            'job-uri',
66            [Value(CharacterStringTags.URI, val)])
67
68class JobId(Attribute):
69    """4.3.2 job-id (integer(1:MAX))
70
71    This REQUIRED attribute contains the ID of the job. The Printer,
72    on receipt of a new job, generates an ID which identifies the new
73    Job on that Printer. The Printer returns the value of the 'job-id'
74    attribute as part of the response to a create request. The 0 value
75    is not included to allow for compatibility with SNMP index values
76    which also cannot be 0.
77
78    For a description of this attribute and its relationship to
79    'job-uri' and 'job-printer-uri' attribute, see the discussion in
80    section 2.4 on 'Object Identity'.
81
82    """
83   
84    def __init__(self, val):
85        super(type(self), self).__init__(
86            'job-id',
87            [Value(IntegerTags.INTEGER, val)])
88
89class JobPrinterUri(Attribute):
90    """4.3.3 job-printer-uri (uri)
91
92    This REQUIRED attribute identifies the Printer object that created
93    this Job object. When a Printer object creates a Job object, it
94    populates this attribute with the Printer object URI that was used
95    in the create request. This attribute permits a client to identify
96    the Printer object that created this Job object when only the Job
97    object's URI is available to the client. The client queries the
98    creating Printer object to determine which languages, charsets,
99    operations, are supported for this Job.
100
101    For a description of this attribute and its relationship to
102    'job-uri' and 'job-id' attribute, see the discussion in section
103    2.4 on 'Object Identity'.
104
105    """
106
107    def __init__(self, val):
108        super(type(self), self).__init__(
109            'job-printer-uri',
110            [Value(CharacterStringTags.URI, val)])
111
112class JobMoreInfo(Attribute):
113    """4.3.4 job-more-info (uri)
114
115    """
116
117    def __init__(self, val):
118        raise ClientErrorAttributes, "job-more-info"
119
120class JobName(Attribute):
121    """4.3.5 job-name (name(MAX))
122   
123    This REQUIRED attribute is the name of the job. It is a name that
124    is more user friendly than the 'job-uri' attribute value. It does
125    not need to be unique between Jobs. The Job's 'job-name' attribute
126    is set to the value supplied by the client in the 'job-name'
127    operation attribute in the create request (see Section 3.2.1.1).
128    If, however, the 'job-name' operation attribute is not supplied by
129    the client in the create request, the Printer object, on creation
130    of the Job, MUST generate a name. The printer SHOULD generate the
131    value of the Job's 'job-name' attribute from the first of the
132    following sources that produces a value: 1) the 'document-name'
133    operation attribute of the first (or only) document, 2) the
134    'document-URI' attribute of the first (or only) document, or 3)
135    any other piece of Job specific and/or Document Content
136    information.
137
138    """
139   
140    def __init__(self, val):
141        super(type(self), self).__init__(
142            'job-name',
143            [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
144
145class JobOriginatingUserName(Attribute):
146    """4.3.6 job-originating-user-name (name(MAX))
147
148    This REQUIRED attribute contains the name of the end user that
149    submitted the print job. The Printer object sets this attribute to
150    the most authenticated printable name that it can obtain from the
151    authentication service over which the IPP operation was received.
152    Only if such is not available, does the Printer object use the
153    value supplied by the client in the 'requesting-user-name'
154    operation attribute of the create operation (see Sections 4.4.2,
155    4.4.3, and 8).  Note: The Printer object needs to keep an internal
156    originating user id of some form, typically as a credential of a
157    principal, with the Job object. Since such an internal attribute
158    is implementation- dependent and not of interest to clients, it is
159    not specified as a Job Description attribute. This originating
160    user id is used for authorization checks (if any) on all
161    subsequent operations.
162
163    """
164   
165    def __init__(self, val):
166        super(type(self), self).__init__(
167            'job-originating-user-name',
168            [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
169
170class JobState(Attribute):
171    """4.3.7 job-state (type1 enum)
172
173    This REQUIRED attribute identifies the current state of the job.
174    Even though the IPP protocol defines seven values for job states
175    (plus the out-of-band 'unknown' value - see Section 4.1),
176    implementations only need to support those states which are
177    appropriate for the particular implementation. In other words, a
178    Printer supports only those job states implemented by the output
179    device and available to the Printer object implementation.
180   
181    """
182   
183    def __init__(self, val):
184        super(type(self), self).__init__(
185            'job-state',
186            [Value(IntegerTags.ENUM, val)])
187
188class JobStateReasons(Attribute):
189    """4.3.8 job-state-reasons (1setOf type2 keyword)
190
191    This REQUIRED attribute provides additional information about the
192    job's current state, i.e., information that augments the value of
193    the job's 'job-state' attribute.
194
195    These values MAY be used with any job state or states for which
196    the reason makes sense. Some of these value definitions indicate
197    conformance requirements; the rest are OPTIONAL. Furthermore, when
198    implemented, the Printer MUST return these values when the reason
199    applies and MUST NOT return them when the reason no longer applies
200    whether the value of the Job's 'job-state' attribute changed or
201    not.  When the Job does not have any reasons for being in its
202    current state, the value of the Job's 'job-state-reasons'
203    attribute MUST be 'none'.
204
205    Note: While values cannot be added to the 'job-state' attribute
206    without impacting deployed clients that take actions upon
207    receiving 'job-state' values, it is the intent that additional
208    'job-state- reasons' values can be defined and registered without
209    impacting such deployed clients. In other words, the
210    'job-state-reasons' attribute is intended to be extensible.
211
212    """
213
214    def __init__(self, *vals):
215        super(type(self), self).__init__(
216            'job-state-reasons',
217            [Value(CharacterStringTags.KEYWORD, val) for val in vals])
218
219class JobStateMessage(Attribute):
220    """4.3.9 job-state-message (text(MAX))
221
222    """
223
224    def __init__(self, val):
225        raise ClientErrorAttributes, "job-state-message"
226
227class JobDetailedStatusMessages(Attribute):
228    """4.3.10 job-detailed-status-messages (1setOf text(MAX))
229
230    """
231
232    def __init__(self, *vals):
233        raise ClientErrorAttributes, "job-detailed-status-messages"
234
235class JobDocumentAccessErrors(Attribute):
236    """4.3.11 job-document-access-errors (1setOf text(MAX))
237
238    """
239
240    def __init__(self, *vals):
241        raise ClientErrorAttributes, "job-document-access-errors"
242
243class NumberOfDocuments(Attribute):
244    """4.3.12 number-of-documents (integer(0:MAX))
245
246    """
247
248    def __init__(self, val):
249        raise ClientErrorAttributes, "number-of-documents"
250
251class OutputDeviceAssigned(Attribute):
252    """4.3.13 output-device-assigned (name(127))
253
254    """
255
256    def __init__(self, val):
257        raise ClientErrorAttributes, "output-device-assigned"
258
259class TimeAtCreation(Attribute):
260    """4.3.14.1 time-at-creation (integer(MIN:MAX))
261
262    This REQUIRED attribute indicates the time at which the Job object
263    was created.
264
265    """
266   
267    def __init__(self, val):
268        super(type(self), self).__init__(
269            "time-at-creation",
270            [Value(IntegerTags.INTEGER, val)])
271
272class TimeAtProcessing(Attribute):
273    """4.3.14.2 time-at-processing (integer(MIN:MAX))
274
275    This REQUIRED attribute indicates the time at which the Job object
276    first began processing after the create operation or the most
277    recent Restart-Job operation. The out-of-band 'no-value' value is
278    returned if the job has not yet been in the 'processing' state
279    (see the beginning of Section 4.1).
280
281    """
282
283    def __init__(self, val):
284        super(type(self), self).__init__(
285            "time-at-processing",
286            [Value(IntegerTags.INTEGER, val)])
287
288class TimeAtCompleted(Attribute):
289    """4.3.14.3 time-at-completed (integer(MIN:MAX))
290
291    This REQUIRED attribute indicates the time at which the Job object
292    completed (or was canceled or aborted). The out-of-band 'no-value'
293    value is returned if the job has not yet completed, been canceled,
294    or aborted (see the beginning of Section 4.1).
295
296    """
297
298    def __init__(self, val):
299        super(type(self), self).__init__(
300            "time-at-completed",
301            [Value(IntegerTags.INTEGER, val)])
302
303class JobPrinterUpTime(Attribute):
304    """4.3.14.4 job-printer-up-time (integer(1:MAX))
305
306    This REQUIRED Job Description attribute indicates the amount of
307    time (in seconds) that the Printer implementation has been up and
308    running.  This attribute is an alias for the 'printer-up-time'
309    Printer Description attribute (see Section 4.4.29).
310
311    A client MAY request this attribute in a Get-Job-Attributes or
312    Get- Jobs request and use the value returned in combination with
313    other requested Event Time Job Description Attributes in order to
314    display time attributes to a user. The difference between this
315    attribute and the 'integer' value of a 'time-at-xxx' attribute is
316    the number of seconds ago that the 'time-at-xxx' event occurred. A
317    client can compute the wall-clock time at which the 'time-at-xxx'
318    event occurred by subtracting this difference from the client's
319    wall-clock time.
320   
321    """
322
323    def __init__(self, val):
324        super(type(self), self).__init__(
325            "job-printer-up-time",
326            [Value(IntegerTags.INTEGER, val)])
327
328
329class DateTimeAtCreation(Attribute):
330    """4.3.14.5 date-time-at-creation (dateTime)
331
332    """
333
334    def __init__(self, val):
335        raise ClientErrorAttributes, "date-time-at-creation"
336
337class DateTimeAtProcessing(Attribute):
338    """4.3.14.6 date-time-at-processing (dateTime)
339
340    """
341
342    def __init__(self, val):
343        raise ClientErrorAttributes, "date-time-at-processing"
344
345class DateTimeAtCompletion(Attribute):
346    """4.3.14.7 date-time-at-completed (dateTime)
347
348    """
349
350    def __init__(self, val):
351        raise ClientErrorAttributes, "date-time-at-completion"
352
353class NumberOfInterveningJobs(Attribute):
354    """4.3.15 number-of-intervening-jobs (integer(0:MAX))
355
356    """
357
358    def __init__(self, val):
359        raise ClientErrorAttributes, "number-of-intervening-jobs"
360
361class JobMessageFromOperator(Attribute):
362    """4.3.16 job-message-from-operator (text(127))
363
364    """
365
366    def __init__(self, val):
367        raise ClientErrorAttributes, "job-message-from-operator"
368
369class JobKOctets(Attribute):
370    """4.3.17.1 job-k-octets (integer(0:MAX))
371
372    This attribute specifies the total size of the document(s) in K
373    octets, i.e., in units of 1024 octets requested to be processed in
374    the job. The value MUST be rounded up, so that a job between 1 and
375    1024 octets MUST be indicated as being 1, 1025 to 2048 MUST be 2,
376    etc.
377
378    This value MUST NOT include the multiplicative factors contributed
379    by the number of copies specified by the 'copies' attribute,
380    independent of whether the device can process multiple copies
381    without making multiple passes over the job or document data and
382    independent of whether the output is collated or not. Thus the
383    value is independent of the implementation and indicates the size
384    of the document(s) measured in K octets independent of the number
385    of copies.  This value MUST also not include the multiplicative
386    factor due to a copies instruction embedded in the document
387    data. If the document data actually includes replications of the
388    document data, this value will include such replication. In other
389    words, this value is always the size of the source document data,
390    rather than a measure of the hardcopy output to be produced.
391
392    """
393   
394    def __init__(self, val):
395        super(type(self), self).__init__(
396            'job-k-octets',
397            [Value(IntegerTags.INTEGER, val)])
398
399class JobImpressions(Attribute):
400    """4.3.17.2 job-impressions (integer(0:MAX))
401
402    """
403
404    def __init__(self, val):
405        raise ClientErrorAttributes, "job-impressions"
406
407class JobMediaSheets(Attribute):
408    """4.3.17.3 job-media-sheets (integer(0:MAX))
409
410    """
411
412    def __init__(self, val):
413        raise ClientErrorAttributes, "job-media-sheets"
414
415class JobKOctetsProcessed(Attribute):
416    """4.3.18.1 job-k-octets-processed (integer(0:MAX))
417
418    """
419
420    def __init__(self, val):
421        raise ClientErrorAttributes, "job-k-octets-processed"
422
423class JobImpressionsCompleted(Attribute):
424    """4.3.18.2 job-impressions-completed (integer(0:MAX))
425
426    """
427
428    def __init__(self, val):
429        raise ClientErrorAttributes, "job-impressions-completed"
430
431class JobMediaSheetsCompleted(Attribute):
432    """4.3.18.3 job-media-sheets-completed (integer(0:MAX))
433
434    """
435
436    def __init__(self, val):
437        raise ClientErrorAttributes, "job-media-sheets-completed"
438
439class AttributesCharset(Attribute):
440    """4.3.19 attributes-charset (charset)
441
442    This REQUIRED attribute is populated using the value in the client
443    supplied 'attributes-charset' attribute in the create request. It
444    identifies the charset (coded character set and encoding method)
445    used by any Job attributes with attribute syntax 'text' and 'name'
446    that were supplied by the client in the create request. See
447    Section 3.1.4 for a complete description of the
448    'attributes-charset' operation attribute.
449
450    This attribute does not indicate the charset in which the 'text'
451    and 'name' values are stored internally in the Job object. The
452    internal charset is implementation-defined. The IPP object MUST
453    convert from whatever the internal charset is to that being
454    requested in an operation as specified in Section 3.1.4.
455
456    """
457   
458    def __init__(self, val):
459        super(type(self), self).__init__(
460            'attributes-charset',
461            [Value(CharacterStringTags.CHARSET, val)])
462
463class AttributesNaturalLanguage(Attribute):
464    """4.3.20 attributes-natural-language (naturalLanguage)
465
466    This REQUIRED attribute is populated using the value in the client
467    supplied 'attributes-natural-language' attribute in the create
468    request. It identifies the natural language used for any Job
469    attributes with attribute syntax 'text' and 'name' that were
470    supplied by the client in the create request. See Section 3.1.4
471    for a complete description of the 'attributes-natural-language'
472    operation attribute. See Sections 4.1.1.2 and 4.1.2.2 for how a
473    Natural Language Override may be supplied explicitly for each
474    'text' and 'name' attribute value that differs from the value
475    identified by the 'attributes-natural-language' attribute.
476
477    """
478   
479    def __init__(self, val):
480        super(type(self), self).__init__(
481            'attributes-natural-language',
482            [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
Note: See TracBrowser for help on using the repository browser.