Ignore:
Timestamp:
Dec 23, 2011, 9:04:31 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
793432f
Parents:
aded2d1
git-author:
Jessica B. Hamrick <jhamrick@…> (12/23/11 21:04:31)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/23/11 21:04:31)
Message:

Use classes for standard IPP attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/ipp/object_attributes/job_description_attributes.py

    raded2d1 rb828a96  
    3737from ..constants import *
    3838
    39 class JobUri(Attribute):
     39def JobUri(val):
    4040    """4.3.1 job-uri (uri)
    4141
     
    6161    """
    6262
    63     def __init__(self, val):
    64         super(type(self), self).__init__(
    65             'job-uri',
    66             [Value(CharacterStringTags.URI, val)])
    67 
    68 class JobId(Attribute):
     63    return Attribute(
     64        'job-uri',
     65        [Value(CharacterStringTags.URI, val)])
     66
     67def JobId(val):
    6968    """4.3.2 job-id (integer(1:MAX))
    7069
     
    8281    """
    8382   
    84     def __init__(self, val):
    85         super(type(self), self).__init__(
    86             'job-id',
    87             [Value(IntegerTags.INTEGER, val)])
    88 
    89 class JobPrinterUri(Attribute):
     83    return Attribute(
     84        'job-id',
     85        [Value(IntegerTags.INTEGER, val)])
     86
     87def JobPrinterUri(val):
    9088    """4.3.3 job-printer-uri (uri)
    9189
     
    105103    """
    106104
    107     def __init__(self, val):
    108         super(type(self), self).__init__(
    109             'job-printer-uri',
    110             [Value(CharacterStringTags.URI, val)])
    111 
    112 class JobMoreInfo(Attribute):
     105    return Attribute(
     106        'job-printer-uri',
     107        [Value(CharacterStringTags.URI, val)])
     108
     109def JobMoreInfo(val):
    113110    """4.3.4 job-more-info (uri)
    114111
    115112    """
    116113
    117     def __init__(self, val):
    118         raise ClientErrorAttributes, "job-more-info"
    119 
    120 class JobName(Attribute):
     114    raise ClientErrorAttributes, "job-more-info"
     115
     116def JobName(val):
    121117    """4.3.5 job-name (name(MAX))
    122118   
     
    138134    """
    139135   
    140     def __init__(self, val):
    141         super(type(self), self).__init__(
    142             'job-name',
    143             [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
    144 
    145 class JobOriginatingUserName(Attribute):
     136    return Attribute(
     137        'job-name',
     138        [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
     139
     140def JobOriginatingUserName(val):
    146141    """4.3.6 job-originating-user-name (name(MAX))
    147142
     
    163158    """
    164159   
    165     def __init__(self, val):
    166         super(type(self), self).__init__(
    167             'job-originating-user-name',
    168             [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
    169 
    170 class JobState(Attribute):
     160    return Attribute(
     161        'job-originating-user-name',
     162        [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
     163
     164def JobState(val):
    171165    """4.3.7 job-state (type1 enum)
    172166
     
    181175    """
    182176   
    183     def __init__(self, val):
    184         super(type(self), self).__init__(
    185             'job-state',
    186             [Value(IntegerTags.ENUM, val)])
    187 
    188 class JobStateReasons(Attribute):
     177    return Attribute(
     178        'job-state',
     179        [Value(IntegerTags.ENUM, val)])
     180
     181def JobStateReasons(val):
    189182    """4.3.8 job-state-reasons (1setOf type2 keyword)
    190183
     
    212205    """
    213206
    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 
    219 class JobStateMessage(Attribute):
     207    return Attribute(
     208        'job-state-reasons',
     209        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     210
     211def JobStateMessage(val):
    220212    """4.3.9 job-state-message (text(MAX))
    221213
    222214    """
    223215
    224     def __init__(self, val):
    225         raise ClientErrorAttributes, "job-state-message"
    226 
    227 class JobDetailedStatusMessages(Attribute):
     216    raise ClientErrorAttributes, "job-state-message"
     217
     218def JobDetailedStatusMessages(val):
    228219    """4.3.10 job-detailed-status-messages (1setOf text(MAX))
    229220
    230221    """
    231222
    232     def __init__(self, *vals):
    233         raise ClientErrorAttributes, "job-detailed-status-messages"
    234 
    235 class JobDocumentAccessErrors(Attribute):
     223    raise ClientErrorAttributes, "job-detailed-status-messages"
     224
     225def JobDocumentAccessErrors(val):
    236226    """4.3.11 job-document-access-errors (1setOf text(MAX))
    237227
    238228    """
    239229
    240     def __init__(self, *vals):
    241         raise ClientErrorAttributes, "job-document-access-errors"
    242 
    243 class NumberOfDocuments(Attribute):
     230    raise ClientErrorAttributes, "job-document-access-errors"
     231
     232def NumberOfDocuments(val):
    244233    """4.3.12 number-of-documents (integer(0:MAX))
    245234
    246235    """
    247236
    248     def __init__(self, val):
    249         raise ClientErrorAttributes, "number-of-documents"
    250 
    251 class OutputDeviceAssigned(Attribute):
     237    raise ClientErrorAttributes, "number-of-documents"
     238
     239def OutputDeviceAssigned(val):
    252240    """4.3.13 output-device-assigned (name(127))
    253241
    254242    """
    255243
    256     def __init__(self, val):
    257         raise ClientErrorAttributes, "output-device-assigned"
    258 
    259 class TimeAtCreation(Attribute):
     244    raise ClientErrorAttributes, "output-device-assigned"
     245
     246def TimeAtCreation(val):
    260247    """4.3.14.1 time-at-creation (integer(MIN:MAX))
    261248
     
    265252    """
    266253   
    267     def __init__(self, val):
    268         super(type(self), self).__init__(
    269             "time-at-creation",
    270             [Value(IntegerTags.INTEGER, val)])
    271 
    272 class TimeAtProcessing(Attribute):
     254    return Attribute(
     255        "time-at-creation",
     256        [Value(IntegerTags.INTEGER, val)])
     257
     258def TimeAtProcessing(val):
    273259    """4.3.14.2 time-at-processing (integer(MIN:MAX))
    274260
     
    281267    """
    282268
    283     def __init__(self, val):
    284         super(type(self), self).__init__(
    285             "time-at-processing",
    286             [Value(IntegerTags.INTEGER, val)])
    287 
    288 class TimeAtCompleted(Attribute):
     269    return Attribute(
     270        "time-at-processing",
     271        [Value(IntegerTags.INTEGER, val)])
     272
     273def TimeAtCompleted(val):
    289274    """4.3.14.3 time-at-completed (integer(MIN:MAX))
    290275
     
    296281    """
    297282
    298     def __init__(self, val):
    299         super(type(self), self).__init__(
    300             "time-at-completed",
    301             [Value(IntegerTags.INTEGER, val)])
    302 
    303 class JobPrinterUpTime(Attribute):
     283    return Attribute(
     284        "time-at-completed",
     285        [Value(IntegerTags.INTEGER, val)])
     286
     287def JobPrinterUpTime(val):
    304288    """4.3.14.4 job-printer-up-time (integer(1:MAX))
    305289
     
    321305    """
    322306
    323     def __init__(self, val):
    324         super(type(self), self).__init__(
    325             "job-printer-up-time",
    326             [Value(IntegerTags.INTEGER, val)])
    327 
    328 
    329 class DateTimeAtCreation(Attribute):
     307    return Attribute(
     308        "job-printer-up-time",
     309        [Value(IntegerTags.INTEGER, val)])
     310
     311
     312def DateTimeAtCreation(val):
    330313    """4.3.14.5 date-time-at-creation (dateTime)
    331314
    332315    """
    333316
    334     def __init__(self, val):
    335         raise ClientErrorAttributes, "date-time-at-creation"
    336 
    337 class DateTimeAtProcessing(Attribute):
     317    raise ClientErrorAttributes, "date-time-at-creation"
     318
     319def DateTimeAtProcessing(val):
    338320    """4.3.14.6 date-time-at-processing (dateTime)
    339321
    340322    """
    341323
    342     def __init__(self, val):
    343         raise ClientErrorAttributes, "date-time-at-processing"
    344 
    345 class DateTimeAtCompletion(Attribute):
     324    raise ClientErrorAttributes, "date-time-at-processing"
     325
     326def DateTimeAtCompletion(val):
    346327    """4.3.14.7 date-time-at-completed (dateTime)
    347328
    348329    """
    349330
    350     def __init__(self, val):
    351         raise ClientErrorAttributes, "date-time-at-completion"
    352 
    353 class NumberOfInterveningJobs(Attribute):
     331    raise ClientErrorAttributes, "date-time-at-completion"
     332
     333def NumberOfInterveningJobs(val):
    354334    """4.3.15 number-of-intervening-jobs (integer(0:MAX))
    355335
    356336    """
    357337
    358     def __init__(self, val):
    359         raise ClientErrorAttributes, "number-of-intervening-jobs"
    360 
    361 class JobMessageFromOperator(Attribute):
     338    raise ClientErrorAttributes, "number-of-intervening-jobs"
     339
     340def JobMessageFromOperator(val):
    362341    """4.3.16 job-message-from-operator (text(127))
    363342
    364343    """
    365344
    366     def __init__(self, val):
    367         raise ClientErrorAttributes, "job-message-from-operator"
    368 
    369 class JobKOctets(Attribute):
     345    raise ClientErrorAttributes, "job-message-from-operator"
     346
     347def JobKOctets(val):
    370348    """4.3.17.1 job-k-octets (integer(0:MAX))
    371349
     
    392370    """
    393371   
    394     def __init__(self, val):
    395         super(type(self), self).__init__(
    396             'job-k-octets',
    397             [Value(IntegerTags.INTEGER, val)])
    398 
    399 class JobImpressions(Attribute):
     372    return Attribute(
     373        'job-k-octets',
     374        [Value(IntegerTags.INTEGER, val)])
     375
     376def JobImpressions(val):
    400377    """4.3.17.2 job-impressions (integer(0:MAX))
    401378
    402379    """
    403380
    404     def __init__(self, val):
    405         raise ClientErrorAttributes, "job-impressions"
    406 
    407 class JobMediaSheets(Attribute):
     381    raise ClientErrorAttributes, "job-impressions"
     382
     383def JobMediaSheets(val):
    408384    """4.3.17.3 job-media-sheets (integer(0:MAX))
    409385
    410386    """
    411387
    412     def __init__(self, val):
    413         raise ClientErrorAttributes, "job-media-sheets"
    414 
    415 class JobKOctetsProcessed(Attribute):
     388    raise ClientErrorAttributes, "job-media-sheets"
     389
     390def JobKOctetsProcessed(val):
    416391    """4.3.18.1 job-k-octets-processed (integer(0:MAX))
    417392
    418393    """
    419394
    420     def __init__(self, val):
    421         raise ClientErrorAttributes, "job-k-octets-processed"
    422 
    423 class JobImpressionsCompleted(Attribute):
     395    raise ClientErrorAttributes, "job-k-octets-processed"
     396
     397def JobImpressionsCompleted(val):
    424398    """4.3.18.2 job-impressions-completed (integer(0:MAX))
    425399
    426400    """
    427401
    428     def __init__(self, val):
    429         raise ClientErrorAttributes, "job-impressions-completed"
    430 
    431 class JobMediaSheetsCompleted(Attribute):
     402    raise ClientErrorAttributes, "job-impressions-completed"
     403
     404def JobMediaSheetsCompleted(val):
    432405    """4.3.18.3 job-media-sheets-completed (integer(0:MAX))
    433406
    434407    """
    435408
    436     def __init__(self, val):
    437         raise ClientErrorAttributes, "job-media-sheets-completed"
    438 
    439 class AttributesCharset(Attribute):
     409    raise ClientErrorAttributes, "job-media-sheets-completed"
     410
     411def AttributesCharset(val):
    440412    """4.3.19 attributes-charset (charset)
    441413
     
    456428    """
    457429   
    458     def __init__(self, val):
    459         super(type(self), self).__init__(
    460             'attributes-charset',
    461             [Value(CharacterStringTags.CHARSET, val)])
    462 
    463 class AttributesNaturalLanguage(Attribute):
     430    return Attribute(
     431        'attributes-charset',
     432        [Value(CharacterStringTags.CHARSET, val)])
     433
     434def AttributesNaturalLanguage(val):
    464435    """4.3.20 attributes-natural-language (naturalLanguage)
    465436
     
    477448    """
    478449   
    479     def __init__(self, val):
    480         super(type(self), self).__init__(
    481             'attributes-natural-language',
    482             [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
     450    return Attribute(
     451        'attributes-natural-language',
     452        [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
Note: See TracChangeset for help on using the changeset viewer.