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/printer_description_attributes.py

    raded2d1 rb828a96  
    4444from ..constants import *
    4545
    46 class PrinterUriSupported(Attribute):
     46def PrinterUriSupported(*vals):
    4747    """4.4.1 printer-uri-supported (1setOf uri)
    4848
     
    6363    """
    6464   
    65     def __init__(self, *vals):
    66         super(type(self), self).__init__(
    67             'printer-uri-supported',
    68             [Value(CharacterStringTags.URI, val) for val in vals])
    69 
    70 
    71 class UriAuthenticationSupported(Attribute):
     65    return Attribute(
     66        'printer-uri-supported',
     67        [Value(CharacterStringTags.URI, val) for val in vals])
     68
     69
     70def UriAuthenticationSupported(*vals):
    7271    """4.4.2 uri-authentication-supported (1setOf type2 keyword)
    7372
     
    8685    """
    8786   
    88     def __init__(self, val):
    89         super(type(self), self).__init__(
    90             'uri-authentication-supported',
    91             [Value(CharacterStringTags.KEYWORD, val)])
    92 
    93 class UriSecuritySupported(Attribute):
     87    return Attribute(
     88        'uri-authentication-supported',
     89        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     90
     91def UriSecuritySupported(*vals):
    9492    """4.4.3 uri-security-supported (1setOf type2 keyword)
    9593
     
    117115    """
    118116   
    119     def __init__(self, val):
    120         super(type(self), self).__init__(
    121             'uri-security-supported',
    122             [Value(CharacterStringTags.KEYWORD, val)])
    123 
    124 class PrinterName(Attribute):
     117    return Attribute(
     118        'uri-security-supported',
     119        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     120
     121def PrinterName(val):
    125122    """4.4.4 printer-name (name(127))
    126123
     
    134131    """
    135132   
    136     def __init__(self, val):
    137         super(type(self), self).__init__(
    138             'printer-name',
    139             [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
    140 
    141 class PrinterLocation(Attribute):
     133    return Attribute(
     134        'printer-name',
     135        [Value(CharacterStringTags.NAME_WITHOUT_LANGUAGE, val)])
     136
     137def PrinterLocation(val):
    142138    """4.4.5 printer-location (text(127))
    143139
    144140    """
    145141
    146     def __init__(self, val):
    147         raise ClientErrorAttributes, "printer-location"
    148 
    149 class PrinterInfo(Attribute):
     142    raise ClientErrorAttributes, "printer-location"
     143
     144def PrinterInfo(val):
    150145    """4.4.6 printer-info (text(127))
    151146
    152147    """
    153148
    154     def __init__(self, val):
    155         raise ClientErrorAttributes, "printer-info"
    156 
    157 class PrinterMoreInfo(Attribute):
     149    raise ClientErrorAttributes, "printer-info"
     150
     151def PrinterMoreInfo(val):
    158152    """4.4.7 printer-more-info (uri)
    159153
    160154    """
    161155
    162     def __init__(self, val):
    163         raise ClientErrorAttributes, "printer-more-info"
    164 
    165 class PrinterDriverInstaller(Attribute):
     156    raise ClientErrorAttributes, "printer-more-info"
     157
     158def PrinterDriverInstaller(val):
    166159    """4.4.8 printer-driver-installer (uri)
    167160
    168161    """
    169162
    170     def __init__(self, val):
    171         raise ClientErrorAttributes, "printer-driver-installer"
    172 
    173 class PrinterMakeAndModel(Attribute):
     163    raise ClientErrorAttributes, "printer-driver-installer"
     164
     165def PrinterMakeAndModel(val):
    174166    """4.4.9 printer-make-and-model (text(127))
    175167
    176168    """
    177169
    178     def __init__(self, val):
    179         raise ClientErrorAttributes, "printer-make-and-model"
    180 
    181 class PrinterMoreInfoManufacturer(Attribute):
     170    raise ClientErrorAttributes, "printer-make-and-model"
     171
     172def PrinterMoreInfoManufacturer(val):
    182173    """4.4.10 printer-more-info-manufacturer (uri)
    183174
    184175    """
    185176
    186     def __init__(self, val):
    187         raise ClientErrorAttributes, "printer-more-info-manufacturer"
    188 
    189 class PrinterState(Attribute):
     177    raise ClientErrorAttributes, "printer-more-info-manufacturer"
     178
     179def PrinterState(val):
    190180    """4.4.11 printer-state (type1 enum)
    191181
     
    203193    """
    204194   
    205     def __init__(self, val):
    206         super(type(self), self).__init__(
    207             'printer-state',
    208             [Value(IntegerTags.ENUM, val)])
    209 
    210 class PrinterStateReasons(Attribute):
     195    return Attribute(
     196        'printer-state',
     197        [Value(IntegerTags.ENUM, val)])
     198
     199def PrinterStateReasons(*vals):
    211200    """4.4.12 printer-state-reasons (1setOf type2 keyword)
    212201
     
    221210    """
    222211   
    223     def __init__(self, val):
    224         super(type(self), self).__init__(
    225             'printer-state-reasons',
    226             [Value(CharacterStringTags.KEYWORD, val)])
    227 
    228 class PrinterStateMessage(Attribute):
     212    return Attribute(
     213        'printer-state-reasons',
     214        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     215
     216def PrinterStateMessage(val):
    229217    """4.4.13 printer-state-message (text(MAX))
    230218
    231219    """
    232220
    233     def __init__(self, val):
    234         raise ClientErrorAttributes, "printer-state-message"
    235 
    236 class IppVersionsSupported(Attribute):
     221    raise ClientErrorAttributes, "printer-state-message"
     222
     223def IppVersionsSupported(*vals):
    237224    """4.4.14 ipp-versions-supported (1setOf type2 keyword)
    238225
     
    266253    """
    267254   
    268     def __init__(self, *vals):
    269         super(type(self), self).__init__(
    270             'ipp-versions-supported',
    271             [Value(CharacterStringTags.KEYWORD, val) for val in vals])
    272 
    273 class OperationsSupported(Attribute):
     255    return Attribute(
     256        'ipp-versions-supported',
     257        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     258
     259def OperationsSupported(*vals):
    274260    """4.4.15 operations-supported (1setOf type2 enum)
    275261
     
    286272    """
    287273   
    288     def __init__(self, *vals):
    289         super(type(self), self).__init__(
    290             'operations-supported',
    291             [Value(IntegerTags.ENUM, val) for val in vals])
    292 
    293 class MultipleDocumentJobsSupported(Attribute):
     274    return Attribute(
     275        'operations-supported',
     276        [Value(IntegerTags.ENUM, val) for val in vals])
     277
     278def MultipleDocumentJobsSupported(val):
    294279    """4.4.16 multiple-document-jobs-supported (boolean)
    295280
     
    302287    """
    303288   
    304     def __init__(self, val):
    305         super(type(self), self).__init__(
    306             'multiple-document-jobs-supported',
    307             [Value(IntegerTags.BOOLEAN, val)])
    308 
    309 class CharsetConfigured(Attribute):
     289    return Attribute(
     290        'multiple-document-jobs-supported',
     291        [Value(IntegerTags.BOOLEAN, val)])
     292
     293def CharsetConfigured(val):
    310294    """4.4.17 charset-configured (charset)
    311295
     
    321305    """
    322306   
    323     def __init__(self, val):
    324         super(type(self), self).__init__(
    325             'charset-configured',
    326             [Value(CharacterStringTags.CHARSET, val)])
    327 
    328 class CharsetSupported(Attribute):
     307    return Attribute(
     308        'charset-configured',
     309        [Value(CharacterStringTags.CHARSET, val)])
     310
     311def CharsetSupported(*vals):
    329312    """4.4.18 charset-supported (1setOf charset)
    330313
     
    344327    """
    345328   
    346     def __init__(self, *vals):
    347         super(type(self), self).__init__(
    348             'charset-supported',
    349             [Value(CharacterStringTags.CHARSET, val) for val in vals])
    350 
    351 class NaturalLanguageConfigured(Attribute):
     329    return Attribute(
     330        'charset-supported',
     331        [Value(CharacterStringTags.CHARSET, val) for val in vals])
     332
     333def NaturalLanguageConfigured(val):
    352334    """4.4.19 natural-language-configured (naturalLanguage)
    353335
     
    370352    """
    371353   
    372     def __init__(self, val):
    373         super(type(self), self).__init__(
    374             'natural-language-configured',
    375             [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
    376 
    377 class GeneratedNaturalLanguageSupported(Attribute):
     354    return Attribute(
     355        'natural-language-configured',
     356        [Value(CharacterStringTags.NATURAL_LANGUAGE, val)])
     357
     358def GeneratedNaturalLanguageSupported(*vals):
    378359    """4.4.20 generated-natural-language-supported (1setOf naturalLanguage)
    379360
     
    402383    """
    403384   
    404     def __init__(self, *vals):
    405         super(type(self), self).__init__(
    406             'generated-natural-language-supported',
    407             [Value(CharacterStringTags.NATURAL_LANGUAGE, val) for val in vals])
    408 
    409 class DocumentFormatDefault(Attribute):
     385    return Attribute(
     386        'generated-natural-language-supported',
     387        [Value(CharacterStringTags.NATURAL_LANGUAGE, val) for val in vals])
     388
     389def DocumentFormatDefault(val):
    410390    """4.4.21 document-format-default (mimeMediaType)
    411391
     
    421401    """
    422402   
    423     def __init__(self, val):
    424         super(type(self), self).__init__(
    425             'document-format-default',
    426             [Value(CharacterStringTags.MIME_MEDIA_TYPE, val)])
    427 
    428 class DocumentFormatSupported(Attribute):
     403    return Attribute(
     404        'document-format-default',
     405        [Value(CharacterStringTags.MIME_MEDIA_TYPE, val)])
     406
     407def DocumentFormatSupported(*vals):
    429408    """4.4.22 document-format-supported (1setOf mimeMediaType)
    430409
     
    436415    """
    437416   
    438     def __init__(self, *vals):
    439         super(type(self), self).__init__(
    440             'document-format-supported',
    441             [Value(CharacterStringTags.MIME_MEDIA_TYPE, val) for val in vals])
    442 
    443 class PrinterIsAcceptingJobs(Attribute):
     417    return Attribute(
     418        'document-format-supported',
     419        [Value(CharacterStringTags.MIME_MEDIA_TYPE, val) for val in vals])
     420
     421def PrinterIsAcceptingJobs(val):
    444422    """4.4.23 printer-is-accepting-jobs (boolean)
    445423
     
    462440    """
    463441   
    464     def __init__(self, val):
    465         super(type(self), self).__init__(
    466             'printer-is-accepting-jobs',
    467             [Value(IntegerTags.BOOLEAN, val)])
    468 
    469 class QueuedJobCount(Attribute):
     442    return Attribute(
     443        'printer-is-accepting-jobs',
     444        [Value(IntegerTags.BOOLEAN, val)])
     445
     446def QueuedJobCount(val):
    470447    """4.4.24 queued-job-count (integer(0:MAX))
    471448
     
    476453    """
    477454   
    478     def __init__(self, val):
    479         super(type(self), self).__init__(
    480             'queued-job-count',
    481             [Value(IntegerTags.INTEGER, val)])
    482 
    483 class PrinterMessageFromOperator(Attribute):
     455    return Attribute(
     456        'queued-job-count',
     457        [Value(IntegerTags.INTEGER, val)])
     458
     459def PrinterMessageFromOperator(val):
    484460    """4.4.25 printer-message-from-operator (text(127))
    485461
    486462    """
    487463
    488     def __init__(self, val):
    489         raise ClientErrorAttributes, "printer-message-from-operator"
    490 
    491 class ColorSupported(Attribute):
     464    raise ClientErrorAttributes, "printer-message-from-operator"
     465
     466def ColorSupported(val):
    492467    """4.4.26 color-supported (boolean)
    493468
    494469    """
    495470
    496     def __init__(self, val):
    497         raise ClientErrorAttributes, "color-supported"
    498 
    499 class ReferenceUriSchemeSupported(Attribute):
     471    raise ClientErrorAttributes, "color-supported"
     472   
     473def ReferenceUriSchemeSupported(val):
    500474    """4.4.27 reference-uri-schemes-supported (1setOf uriScheme)
    501475
    502476    """
    503477
    504     def __init__(self, *vals):
    505         raise ClientErrorAttributes, "reference-uri-scheme-supported"
    506 
    507 class PdlOverrideSupported(Attribute):
     478    raise ClientErrorAttributes, "reference-uri-scheme-supported"
     479
     480def PdlOverrideSupported(val):
    508481    """4.4.28 pdl-override-supported (type2 keyword)
    509482
     
    528501    """
    529502   
    530     def __init__(self, val):
    531         super(type(self), self).__init__(
    532             'pdl-override-supported',
    533             [Value(CharacterStringTags.KEYWORD, val)])
    534 
    535 class PrinterUpTime(Attribute):
     503    return Attribute(
     504        'pdl-override-supported',
     505        [Value(CharacterStringTags.KEYWORD, val)])
     506
     507def PrinterUpTime(val):
    536508    """4.4.29 printer-up-time (integer(1:MAX))
    537509
     
    566538    """
    567539   
    568     def __init__(self, val):
    569         super(type(self), self).__init__(
    570             'printer-up-time',
    571             [Value(IntegerTags.INTEGER, val)])
    572 
    573 class PrinterCurrentTime(Attribute):
     540    return Attribute(
     541        'printer-up-time',
     542        [Value(IntegerTags.INTEGER, val)])
     543
     544def PrinterCurrentTime(val):
    574545    """4.4.30 printer-current-time (dateTime)
    575546
    576547    """
    577548
    578     def __init__(self, val):
    579         raise ClientErrorAttributes, "printer-current-time"
    580 
    581 class MultipleOperationTimeOut(Attribute):
     549    raise ClientErrorAttributes, "printer-current-time"
     550
     551def MultipleOperationTimeOut(val):
    582552    """4.4.31 multiple-operation-time-out (integer(1:MAX))
    583553
     
    598568    """
    599569   
    600     def __init__(self, val):
    601         super(type(self), self).__init__(
    602             'multiple-operation-time-out',
    603             [Value(IntegerTags.INTEGER, val)])
    604 
    605 class CompressionSupported(Attribute):
     570    return Attribute(
     571        'multiple-operation-time-out',
     572        [Value(IntegerTags.INTEGER, val)])
     573
     574def CompressionSupported(*vals):
    606575    """4.4.32 compression-supported (1setOf type3 keyword)
    607576
     
    623592    """
    624593   
    625     def __init__(self, *vals):
    626         super(type(self), self).__init__(
    627             'compression-supported',
    628             [Value(CharacterStringTags.KEYWORD, val) for val in vals])
    629 
    630 class JobKOctetsSupported(Attribute):
     594    return Attribute(
     595        'compression-supported',
     596        [Value(CharacterStringTags.KEYWORD, val) for val in vals])
     597
     598def JobKOctetsSupported(val):
    631599    """4.4.33 job-k-octets-supported (rangeOfInteger(0:MAX))
    632600
    633601    """
    634602
    635     def __init__(self, val):
    636         raise ClientErrorAttributes, "job-k-octets-supported"
    637 
    638 class JobImpressionsSupported(Attribute):
     603    raise ClientErrorAttributes, "job-k-octets-supported"
     604
     605def JobImpressionsSupported(val):
    639606    """4.4.34 job-impressions-supported (rangeOfInteger(0:MAX))
    640607
    641608    """
    642609
    643     def __init__(self, val):
    644         raise ClientErrorAttributes, "job-impressions-supported"
    645 
    646 class JobMediaSheetsSupported(Attribute):
     610    raise ClientErrorAttributes, "job-impressions-supported"
     611
     612def JobMediaSheetsSupported(val):
    647613    """4.4.35 job-media-sheets-supported (rangeOfInteger(0:MAX))
    648614
    649615    """
    650616
    651     def __init__(self, val):
    652         raise ClientErrorAttributes, "job-media-sheets-supported"
    653 
    654 class PagesPerMinute(Attribute):
     617    raise ClientErrorAttributes, "job-media-sheets-supported"
     618
     619def PagesPerMinute(val):
    655620    """4.4.36 pages-per-minute (integer(0:MAX))
    656621
    657622    """
    658623
    659     def __init__(self, val):
    660         raise ClientErrorAttributes, "pages-per-minute"
    661 
    662 class PagesPerMinuteColor(Attribute):
     624    raise ClientErrorAttributes, "pages-per-minute"
     625
     626def PagesPerMinuteColor(val):
    663627    """4.4.37 pages-per-minute-color (integer(0:MAX))
    664628
    665629    """
    666630
    667     def __init__(self, val):
    668         raise ClientErrorAttributes, "pages-per-minute-color"
    669    
     631    raise ClientErrorAttributes, "pages-per-minute-color"
     632   
Note: See TracChangeset for help on using the changeset viewer.