Changeset ebf327d for server/lib/ipprequest.py
- Timestamp:
- Mar 5, 2011, 10:42:40 PM (14 years ago)
- Branches:
- no-cups
- Children:
- 5cfb358
- Parents:
- cf1d291
- git-author:
- Jessica B. Hamrick <jhamrick@…> (03/05/11 22:42:40)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (03/05/11 22:42:40)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/ipprequest.py
r2646571 rebf327d 2 2 3 3 import sys, struct, logging 4 from ippattributegroup import IPPAttributeGroup5 from ippattribute import IPPAttribute6 from ippvalue import IPPValue4 from ippattributegroup import AttributeGroup 5 from ippattribute import Attribute 6 from ippvalue import Value 7 7 8 8 # initialize logger 9 9 logger = logging.getLogger("ippLogger") 10 10 11 class IPPRequest():11 class Request(): 12 12 """ 13 13 From RFC 2565: … … 39 39 attribute_groups=[], data=None, request=None, length=sys.maxint): 40 40 """ 41 Create an IPPRequest. Takes either the segments of the 42 request separately, or a file handle for the request to parse. 43 If the file handle is passed in, all other arguments are 44 ignored. 41 Create a Request. Takes either the segments of the request 42 separately, or a file handle for the request to parse. If the 43 file handle is passed in, all other arguments are ignored. 45 44 46 45 Keyword arguments for passing in the segments of the request: … … 56 55 request itself. 57 56 58 attribute_groups -- a list of IPPAttributes, at least length 157 attribute_groups -- a list of Attributes, at least length 1 59 58 60 59 data -- (optional) variable length, containing the actual … … 77 76 # make sure the request id isn't empty 78 77 assert request_id is not None 79 # make sure attribute_groups is a list of IPPAttributes78 # make sure attribute_groups is a list of Attributes 80 79 assert len(attribute_groups) > 0 81 for a in attribute_groups: assert isinstance(a, IPPAttributeGroup)80 for a in attribute_groups: assert isinstance(a, AttributeGroup) 82 81 83 82 # if the request isn't None, then we'll read directly from … … 148 147 length -= value_length 149 148 150 ippvalue = IPPValue(value_tag, value)149 ippvalue = Value(value_tag, value) 151 150 logger.debug("value : %s" % ippvalue.value) 152 151 153 # create a new IPPAttribute from the data we just152 # create a new Attribute from the data we just 154 153 # read in, and add it to our attributes list 155 attributes.append( IPPAttribute(name, [ippvalue]))154 attributes.append(Attribute(name, [ippvalue])) 156 155 157 156 else: … … 165 164 length -= value_length 166 165 167 ippvalue = IPPValue(value_tag, value)166 ippvalue = Value(value_tag, value) 168 167 logger.debug("value : %s" % ippvalue.value) 169 168 … … 175 174 length -= 1 176 175 177 self.attribute_groups.append(IPPAttributeGroup(attribute_group_tag, attributes)) 176 self.attribute_groups.append(AttributeGroup( 177 attribute_group_tag, attributes)) 178 178 179 179 # once we hit the end-of-attributes tag, the only thing
Note: See TracChangeset
for help on using the changeset viewer.