Ignore:
Timestamp:
Dec 20, 2011, 1:47:11 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
6effd50
Parents:
5fe360e
git-author:
Jessica B. Hamrick <jhamrick@…> (12/20/11 13:47:11)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/20/11 13:47:11)
Message:

Fix some errors in ipp/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/ipp/operations.py

    r71bfce0 rf6c6897  
    33from .attributegroup import AttributeGroup
    44from .request import Request
    5 from .constants import AttributeTags, operations_attribute_value_tags
     5from .constants import AttributeTags, StatusCodes, operations_attribute_value_tags
    66import exceptions as err
    7 
    8 from collections import OrderedDictionary as odict
    97
    108def verify_operations(request):
     
    4341
    4442    # check charset
    45     charset attribute
    4643    charset_attr = op_attrs.attributes[0]
    4744    if charset_attr.name != 'attributes-charset':
     
    7370    if natlang_value.tag != operations_attribute_value_tags['attributes-natural-language']:
    7471        raise err.BadRequest(
    75             "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" natlang_value.tag)
     72            "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" % natlang_value.tag)
    7673    if natlang_value.value != 'en-us':
    7774        raise err.Attributes(
     
    115112    # Operation attributes -- typically the same for any request
    116113    attributes = [
    117         ipp.Attribute(
     114        Attribute(
    118115            'attributes-charset',
    119             [(operations_attribute_value_tags['attributes-charset'], 'utf-8')]),
    120         ipp.Attribute(
     116            [Value(operations_attribute_value_tags['attributes-charset'], 'utf-8')]),
     117        Attribute(
    121118            'attributes-natural-language',
    122             [(operations_attribute_value_tags['attributes-natural-language'], 'en-us')])
     119            [Value(operations_attribute_value_tags['attributes-natural-language'], 'en-us')])
    123120        ]
    124121    # Put the operation attributes in a group
    125     attribute_group = ipp.AttributeGroup(
    126         const.AttributeTags.OPERATION,
     122    attribute_group = AttributeGroup(
     123        AttributeTags.OPERATION,
    127124        attributes)
    128125
     
    131128    response_kwargs = {}
    132129    response_kwargs['version']          = request.version
    133     response_kwargs['operation_id']     = const.StatusCodes.OK
     130    response_kwargs['operation_id']     = StatusCodes.OK
    134131    response_kwargs['request_id']       = request.request_id
    135132    response_kwargs['attribute_groups'] = [attribute_group]
    136     response = ipp.Request(**response_kwargs)
     133    response = Request(**response_kwargs)
    137134
    138135    return response
     
    168165            if 'which-jobs' or 'my-jobs' constrain which jobs are
    169166            returned. The limit is a 'stateless limit' in that if
    170             the value supplied by the client is ’N’, then only the
    171             first ’N’ jobs are returned in the Get-Jobs Response.
    172             There is no mechanism to allow for the next ’M’ jobs
    173             after the first ’N’ jobs. If the client does not
     167            the value supplied by the client is 'N', then only the
     168            first 'N' jobs are returned in the Get-Jobs Response.
     169            There is no mechanism to allow for the next 'M' jobs
     170            after the first 'N' jobs. If the client does not
    174171            supply this attribute, the Printer object responds
    175172            with all applicable jobs.
     
    185182            the client does not supply this attribute, the Printer
    186183            MUST respond as if the client had supplied this
    187             attribute with two values: ’job-uri’ and ’job-id’.
     184            attribute with two values: 'job-uri' and 'job-id'.
    188185        'which-jobs' (type2 keyword):
    189186            The client OPTIONALLY supplies this attribute. The
     
    191188            indicates which Job objects MUST be returned by the
    192189            Printer object. The values for this attribute are:
    193              - ’completed’: This includes any Job object whose
    194                state is ’completed’, ’canceled’, or ’aborted’.
    195              - ’not-completed’: This includes any Job object whose
    196                state is ’pending’, ’processing’,
    197                ’processing-stopped’, or ’pending-held’.
     190             - 'completed': This includes any Job object whose
     191               state is 'completed', 'canceled', or 'aborted'.
     192             - 'not-completed': This includes any Job object whose
     193               state is 'pending', 'processing',
     194               'processing-stopped', or 'pending-held'.
    198195            A Printer object MUST support both values. However, if
    199196            the implementation does not keep jobs in the
    200             ’completed’, ’canceled’, and ’aborted’ states, then it
    201             returns no jobs when the ’completed’ value is
     197            'completed', 'canceled', and 'aborted' states, then it
     198            returns no jobs when the 'completed' value is
    202199            supplied.  If a client supplies some other value, the
    203200            Printer object MUST copy the attribute and the
    204201            unsupported value to the Unsupported Attributes
    205202            response group, reject the request, and return the
    206             ’client-error-attributes-or-values-not-supported’
     203            'client-error-attributes-or-values-not-supported'
    207204            status code.  If the client does not supply this
    208205            attribute, the Printer object MUST respond as if the
    209206            client had supplied the attribute with a value of
    210             ’not-completed’.
     207            'not-completed'.
    211208        'my-jobs' (boolean):
    212209            The client OPTIONALLY supplies this attribute. The
     
    218215            attribute, the Printer object MUST respond as if the
    219216            client had supplied the attribute with a value of
    220             ’false’, i.e., jobs from all users. The means for
     217            'false', i.e., jobs from all users. The means for
    221218            authenticating the requesting user and matching the
    222219            jobs is described in section 8.
     
    268265    response returns 0 jobs because there are no jobs matching the
    269266    criteria, and the request would have returned 1 or more jobs
    270     with a status code of ’successful-ok’ if there had been jobs
     267    with a status code of 'successful-ok' if there had been jobs
    271268    matching the criteria, then the status code for 0 jobs MUST be
    272     ’successful-ok’.
     269    'successful-ok'.
    273270
    274271    Group 1: Operation Attributes
     
    293290        referenced in the 'requested-attributes' operation
    294291        attribute and that attribute included group names, such as
    295         ’all’, the unsupported attributes MUST NOT include
     292        'all', the unsupported attributes MUST NOT include
    296293        attributes described in the standard but not supported by
    297294        the implementation.
     
    306303        job (job originating user) or not (see section
    307304        8). However, the Printer object MUST respond with the
    308         ’unknown’ value for any supported attribute (including all
     305        'unknown' value for any supported attribute (including all
    309306        REQUIRED attributes) for which the Printer object does not
    310307        know the value, unless it would violate the security
     
    313310
    314311        Jobs are returned in the following order:
    315         - If the client requests all ’completed’ Jobs (Jobs in the
    316           ’completed’, ’aborted’, or ’canceled’ states), then the
     312        - If the client requests all 'completed' Jobs (Jobs in the
     313          'completed', 'aborted', or 'canceled' states), then the
    317314          Jobs are returned newest to oldest (with respect to
    318315          actual completion time)
    319         - If the client requests all ’not-completed’ Jobs (Jobs in
    320           the ’pending’, ’processing’, ’pending-held’, and
    321           ’processing- stopped’ states), then Jobs are returned in
     316        - If the client requests all 'not-completed' Jobs (Jobs in
     317          the 'pending', 'processing', 'pending-held', and
     318          'processing- stopped' states), then Jobs are returned in
    322319          relative chronological order of expected time to
    323320          complete (based on whatever scheduling algorithm is
Note: See TracChangeset for help on using the changeset viewer.