Changeset ffbe41d for server/lib/gutenbach/ipp/core/value.py
- Timestamp:
- Jan 10, 2012, 7:25:33 PM (12 years ago)
- Branches:
- no-cups
- Children:
- b01b6d1
- Parents:
- ce2abc5
- git-author:
- Jessica B. Hamrick <jhamrick@…> (01/10/12 19:25:33)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (01/10/12 19:25:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/ipp/core/value.py
r793432f rffbe41d 46 46 47 47 # make sure the arguments are valid 48 if value is not None: 49 assert tag is not None, \ 50 "tag must not be null because " + \ 51 "value is not null!" 48 if value is not None and tag is None: 49 raise ValueError("tag may not be None") 52 50 53 51 # initialize member variables 54 self.tag = tag# one byte, the type of value55 self.value = value# non-binary value of self.value52 self.tag = tag # one byte, the type of value 53 self.value = value # non-binary value of self.value 56 54 57 55 def __cmp__(self, other): … … 76 74 """ 77 75 78 assert tag is not None, \79 "Cannot unpack values with unspecified value tag!"80 assert packed_value is not None, \81 "Cannot unpack null values!"76 if tag is None: 77 raise ValueError("cannot unpack values with no value tag") 78 if packed_value is None: 79 raise ValueError("cannot unpack null values") 82 80 83 81 value = None … … 172 170 173 171 """ 174 175 assert self.tag is not None, \176 "cannot pack value with null value tag!"177 assert self.value is not None, \178 "cannot pack null value!"172 173 if self.tag is None: 174 raise ValueError("cannot pack value with null tag") 175 if self.value is None: 176 raise ValueError("cannot pack null value") 179 177 180 178 packed_value = None … … 221 219 # contains the units 222 220 223 packed_value = truct.pack('>iib', *self.value)221 packed_value = struct.pack('>iib', *self.value) 224 222 225 223 elif self.tag == OctetStringTags.RANGE_OF_INTEGER: … … 291 289 return self.packed_value_size + 1 292 290 293 @property294 def pyobj(self):295 return (self.tag, self.value)296 297 291 def __str__(self): 298 292 return str(self.value)
Note: See TracChangeset
for help on using the changeset viewer.