Changeset 5c5fe6d for server/lib/gutenbach/ipp/value.py
- Timestamp:
- Dec 17, 2011, 5:52:59 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 287d6ec
- Parents:
- 5d24a81
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/ipp/value.py
rdf51061 r5c5fe6d 7 7 logger = logging.getLogger(__name__) 8 8 9 def setter(prop):10 def f(func):11 return property(prop.fget, func, prop.fdel, prop.__doc__)12 return f13 14 9 class Value(object): 15 """ 16 An IPP value consists of a tag and a value. 10 """An IPP value consists of a tag and a value. 17 11 18 12 From RFC 2565: … … 26 20 | value | v bytes 27 21 ----------------------------------------------- 22 28 23 """ 29 24 30 25 def __init__(self, value_tag=None, value=None): 31 """ 32 Initialize a Value. There are three different ways you can 26 """Initialize a Value. There are three different ways you can 33 27 call this method: 34 28 … … 48 42 value -- variable size, containing the actual value. 49 43 It should be a string or number. 44 50 45 """ 51 46 … … 62 57 @classmethod 63 58 def unpack(cls, value_tag, packed_value): 64 """Unpack a binary IPP value 65 66 Unpacks a binary string into a Value object. 59 """Unpack a binary IPP value into a Value object. 67 60 68 61 """ … … 71 64 @staticmethod 72 65 def _unpack(value_tag, packed_value): 73 """ 74 Given self.value_tag and self.packed_value, unpack the binary 75 value into either a string or number. These values MUST NOT 76 be null. 66 """Given self.value_tag and self.packed_value, unpack the 67 binary value into either a string or number. These values 68 MUST NOT be null. 77 69 78 70 Returns: unpacked value … … 170 162 @property 171 163 def packed_value(self): 172 """ 173 Given self.value_tag and self.value, pack the value into 164 """Given self.value_tag and self.value, pack the value into 174 165 binary form. These values MUST NOT be null. 175 166 … … 270 261 return packed_value 271 262 272 @ setter(packed_value)263 @packed_value.setter 273 264 def packed_value(self, packed_value): 274 265 """Replace a value using a new packed value … … 281 272 @property 282 273 def packed_value_size(self): 283 """ 284 Get the size of the value in bytes.274 """Get the size of the value in bytes. 275 285 276 """ 286 277 … … 289 280 @property 290 281 def total_size(self): 291 """ 292 Get the total size of the IPP value.282 """Get the total size of the IPP value. 283 293 284 """ 294 285
Note: See TracChangeset
for help on using the changeset viewer.