Changeset ebf327d


Ignore:
Timestamp:
Mar 5, 2011, 10:42:40 PM (14 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

Location:
server/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • server/lib/ippattribute.py

    r2646571 rebf327d  
    22
    33import sys, struct, logging
    4 from ippvalue import IPPValue
     4from ippvalue import Value
    55
    66# initialize logger
    77logger = logging.getLogger("ippLogger")
    88
    9 class IPPAttribute():
     9class Attribute():
    1010    """
    1111    In addition to what the RFC reports, an attribute has an
     
    4242    def __init__(self, name, values):
    4343        """
    44         Initialize an IPPAttribute.
     44        Initialize an Attribute.
    4545       
    4646        Arguments:
     
    4848            name -- the name of the attribute
    4949
    50             values -- a list of IPPValues.  May not be empty.
     50            values -- a list of Values.  May not be empty.
    5151        """
    5252
     
    5656        # make sure the list of values isn't empty
    5757        assert len(values) > 0
    58         # make sure each value is an IPPValue
    59         for value in values: assert isinstance(value, IPPValue)
     58        # make sure each value is a Value
     59        for value in values: assert isinstance(value, Value)
    6060         
    6161        self.name = name
  • server/lib/ippattributegroup.py

    r2646571 rebf327d  
    22
    33import sys, struct, logging
    4 from ippattribute import IPPAttribute
     4from ippattribute import Attribute
    55
    66# initialize logger
    77logger = logging.getLogger("ippLogger")
    88
    9 class IPPAttributeGroup():
     9class AttributeGroup():
    1010    """
    11     An IPPAttributeGroup consists of an attribute-group-tag, followed
    12     by a sequence of IPPAttributes.
     11    An AttributeGroup consists of an attribute-group-tag, followed by
     12    a sequence of Attributes.
    1313    """
    1414
    1515    def __init__(self, attribute_group_tag, attributes=[]):
    1616        """
    17         Initialize an IPPAttributeGroup.
     17        Initialize an AttributeGroup.
    1818
    1919        Arguments:
     
    2828        assert attribute_group_tag is not None
    2929
    30         # make sure attributes is a list or tuple of IPPAttributes
     30        # make sure attributes is a list or tuple of Attributes
    3131        assert isinstance(attributes, (list, tuple))
    32         for a in attributes: assert isinstance(a, IPPAttribute)
     32        for a in attributes: assert isinstance(a, Attribute)
    3333
    3434        self.attribute_group_tag = attribute_group_tag
     
    4040    def toBinaryData(self):
    4141        """
    42         Convert the IPPAttributeGroup to binary.
     42        Convert the AttributeGroup to binary.
    4343        """
    4444
  • 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
  • server/lib/ippvalue.py

    r2646571 rebf327d  
    77logger = logging.getLogger("ippLogger")
    88
    9 class IPPValue():
     9class Value():
    1010    """
    1111    An IPP value consists of a tag and a value, and optionally, a name.
     
    2727    def __init__(self, value_tag, value, unpack=True):
    2828        """
    29         Initialize an IPPValue:
     29        Initialize a Value:
    3030
    3131        Arguments:
Note: See TracChangeset for help on using the changeset viewer.