Ignore:
Timestamp:
Mar 5, 2011, 10:42:40 PM (13 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
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)
Message:

Change IPPValue, IPPAttribute, IPPAttributeGroup, and IPPRequest to Value, Attribute, AttributeGroup?, and Request, respectively, to make things a little less verbose

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/ipprequest.py

    r2646571 rebf327d  
    22
    33import sys, struct, logging
    4 from ippattributegroup import IPPAttributeGroup
    5 from ippattribute import IPPAttribute
    6 from ippvalue import IPPValue
     4from ippattributegroup import AttributeGroup
     5from ippattribute import Attribute
     6from ippvalue import Value
    77
    88# initialize logger
    99logger = logging.getLogger("ippLogger")
    1010
    11 class IPPRequest():
     11class Request():
    1212    """
    1313    From RFC 2565:
     
    3939                 attribute_groups=[], data=None, request=None, length=sys.maxint):
    4040        """
    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.
    4544
    4645        Keyword arguments for passing in the segments of the request:
     
    5655                          request itself.
    5756
    58             attribute_groups -- a list of IPPAttributes, at least length 1
     57            attribute_groups -- a list of Attributes, at least length 1
    5958
    6059            data -- (optional) variable length, containing the actual
     
    7776            # make sure the request id isn't empty
    7877            assert request_id is not None
    79             # make sure attribute_groups is a list of IPPAttributes
     78            # make sure attribute_groups is a list of Attributes
    8079            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)
    8281           
    8382        # if the request isn't None, then we'll read directly from
     
    148147                        length -= value_length
    149148                       
    150                         ippvalue = IPPValue(value_tag, value)
     149                        ippvalue = Value(value_tag, value)
    151150                        logger.debug("value : %s" % ippvalue.value)
    152151
    153                         # create a new IPPAttribute from the data we just
     152                        # create a new Attribute from the data we just
    154153                        # read in, and add it to our attributes list
    155                         attributes.append(IPPAttribute(name, [ippvalue]))
     154                        attributes.append(Attribute(name, [ippvalue]))
    156155
    157156                    else:
     
    165164                        length -= value_length
    166165
    167                         ippvalue = IPPValue(value_tag, value)
     166                        ippvalue = Value(value_tag, value)
    168167                        logger.debug("value : %s" % ippvalue.value)
    169168
     
    175174                    length -= 1
    176175
    177                 self.attribute_groups.append(IPPAttributeGroup(attribute_group_tag, attributes))
     176                self.attribute_groups.append(AttributeGroup(
     177                    attribute_group_tag, attributes))
    178178
    179179            # once we hit the end-of-attributes tag, the only thing
Note: See TracChangeset for help on using the changeset viewer.