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_template_attributes.py

    raded2d1 rb828a96  
    1919from ..exceptions import ClientErrorAttributes
    2020
    21 class JobPriority(Attribute):
     21def JobPriority(val):
    2222    """4.2.1 job-priority (integer(1:100))
    2323
     
    6969   
    7070   
    71     def __init__(self, val):
    72         super(type(self), self).__init__(
    73             'job-priority',
    74             [Value(IntegerTags.INTEGER), val])
     71    return Attribute(
     72        'job-priority',
     73        [Value(IntegerTags.INTEGER), val])
    7574
    76 class JobHoldUntil(Attribute):
     75def JobHoldUntil(val):
    7776    """4.2.2 job-hold-until (type3 keyword | name (MAX))
    7877   
    7978    """
    8079
    81     def __init__(self, val):
    82         raise ClientErrorAttributes, "job-hold-until"
    83 
    84 class JobSheets(Attribute):
     80    raise ClientErrorAttributes, "job-hold-until"
     81   
     82def JobSheets(val):
    8583    """4.2.3 job-sheets (type3 keyword | name(MAX))
    8684
    8785    """
     86   
     87    raise ClientErrorAttributes, "job-sheets"
    8888
    89     def __init__(self, val):
    90         raise ClientErrorAttributes, "job-sheets"
    91 
    92 class MultipleDocumentHandling(Attribute):
     89def MultipleDocumentHandling(val):
    9390    """4.2.4 multiple-document-handling (type2 keyword)
    9491
    9592    """
    9693
    97     def __init__(self, val):
    98         raise ClientErrorAttributes, "multiple-document-handling"
     94    raise ClientErrorAttributes, "multiple-document-handling"
    9995
    100 class Copies(Attribute):
     96def Copies(val):
    10197    """4.2.5 copies (integer(1:MAX))
    10298
    10399    """
     100   
     101    raise ClientErrorAttributes, "copies"
    104102
    105     def __init__(self, val):
    106         raise ClientErrorAttributes, "copies"
    107 
    108 class Finishings(Attribute):
     103def Finishings(*vals):
    109104    """4.2.6 finishings (1setOf type2 enum)
    110105
    111106    """
    112107
    113     def __init__(self, *vals):
    114         raise ClientErrorAttributes, "finishings"
     108    raise ClientErrorAttributes, "finishings"
    115109
    116 class PageRanges(Attribute):
     110def PageRanges(*vals):
    117111    """4.2.7 page-ranges (1setOf rangeOfInteger (1:MAX))
    118112
    119113    """
    120114
    121     def __init__(self, *vals):
    122         raise ClientErrorAttributes, "page-ranges"
     115    raise ClientErrorAttributes, "page-ranges"
    123116
    124 class Sides(Attribute):
     117def Sides(val):
    125118    """4.2.8 sides (type2 keyword)
    126119
    127120    """
    128121
    129     def __init__(self, val):
    130         raise ClientErrorAttributes, "sides"
     122    raise ClientErrorAttributes, "sides"
    131123
    132 class NumberUp(Attribute):
     124def NumberUp(val):
    133125    """4.2.9 number-up (integer(1:MAX))
    134126
    135127    """
    136128
    137     def __init__(self, val):
    138         raise ClientErrorAttributes, "number-up"
     129    raise ClientErrorAttributes, "number-up"
    139130
    140 class OrientationRequested(Attribute):
     131def OrientationRequested(val):
    141132    """4.2.10 orientation-requested (type2 enum)
    142133
    143134    """
    144135
    145     def __init__(self, val):
    146         raise ClientErrorAttributes, "orientation-requested"
     136    raise ClientErrorAttributes, "orientation-requested"
    147137
    148 class Media(Attribute):
     138def Media(val):
    149139    """4.2.11 media (type3 keyword | name(MAX))
    150140
    151141    """
    152142
    153     def __init__(self, val):
    154         raise ClientErrorAttributes, "media"
     143    raise ClientErrorAttributes, "media"
    155144
    156145### XXX: we may want to repurpose this for bitrate?
    157 class PrinterResolution(Attribute):
     146def PrinterResolution(val):
    158147    """4.2.12 printer-resolution (resolution)
    159148
    160149    """
    161150
    162     def __init__(self, val):
    163         raise ClientErrorAttributes, "printer-resolution"
     151    raise ClientErrorAttributes, "printer-resolution"
    164152
    165 class PrintQuality(Attribute):
     153def PrintQuality(val):
    166154    """4.2.13 print-quality (type2 enum)
    167155
    168156    """
    169157
    170     def __init__(self, val):
    171         raise ClientErrorAttributes, "print-quality"
     158    raise ClientErrorAttributes, "print-quality"
Note: See TracChangeset for help on using the changeset viewer.