Changeset 97f20dd


Ignore:
Timestamp:
Jan 22, 2012, 1:05:21 AM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
2834b9a
Parents:
b3a56af
git-author:
Jessica B. Hamrick <jhamrick@…> (01/22/12 01:05:21)
git-committer:
Jessica B. Hamrick <jhamrick@…> (01/22/12 01:05:21)
Message:

Add documentation for printer and job attributes

Location:
server/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/ipp/core/constants.py

    r609a9b0 r97f20dd  
    2121    """
    2222
    23     PENDING    = 3
    24     HELD       = 4
    25     PROCESSING = 5
    26     STOPPED    = 6
    27     CANCELLED  = 7
    28     ABORTED    = 8
    29     COMPLETE   = 9
     23    PENDING            = 3
     24    PENDING_HELD       = 4
     25    PROCESSING         = 5
     26    PROCESSING_STOPPED = 6
     27    CANCELED           = 7
     28    ABORTED            = 8
     29    COMPLETED          = 9
    3030
    3131    def __init__(self): pass
  • server/lib/gutenbach/server/job.py

    r0494098 r97f20dd  
    168168               self.player is not None and \
    169169               not self.player.is_playing and \
    170                not self._why_done == "cancelled" and \
     170               not self._why_done == "canceled" and \
    171171               not self._why_done == "aborted"
    172172
     
    202202                self.player is not None and \
    203203                self.player.is_done) or \
    204                 (self._why_done == "cancelled" or \
     204                (self._why_done == "canceled" or \
    205205                 self._why_done == "aborted")
    206206
     
    214214
    215215    @property
    216     def is_cancelled(self):
    217         """Whether the job was cancelled.
    218 
    219         """
    220 
    221         return self.is_done and self._why_done == "cancelled"
     216    def is_canceled(self):
     217        """Whether the job was canceled.
     218
     219        """
     220
     221        return self.is_done and self._why_done == "canceled"
    222222
    223223    @property
     
    235235       
    236236            HELD ---> PENDING ---> PROCESSING <--> STOPPED (aka paused)
    237                          ^              |---> CANCELLED
     237                         ^              |---> CANCELED
    238238                         |              |---> ABORTED
    239239                         |              |---> COMPLETE ---|
     
    247247            state = States.PROCESSING
    248248        elif self.is_playing and self.is_paused:
    249             state = States.STOPPED
     249            state = States.PROCESSING_STOPPED
    250250        elif self.is_completed:
    251             state = States.COMPLETE
    252         elif self.is_cancelled:
    253             state = States.CANCELLED
     251            state = States.COMPLETED
     252        elif self.is_canceled:
     253            state = States.CANCELED
    254254        elif self.is_aborted:
    255255            state = States.ABORTED
    256256        else:
    257             state = States.HELD
     257            state = States.PENDING_HELD
    258258        return state
    259259
     
    293293        """
    294294
    295         if not self.is_valid or self.state != States.HELD:
     295        if not self.is_valid or self.state != States.PENDING_HELD:
    296296            raise errors.InvalidJobStateException(self.state)
    297297        self.verify_document(document)
     
    357357        """Blocking cancel. The job must not have been previously
    358358        aborted or completed (though this method will succeed if it
    359         was previously cancelled).  This should be used to stop the
     359        was previously canceled).  This should be used to stop the
    360360        job following an external request.
    361361
     
    371371            self.player.mplayer_stop()
    372372
    373         elif self.is_done and not self._why_done == "cancelled":
    374             raise errors.InvalidJobStateException(self.state)
    375 
    376         logger.info("cancelled job %s" % str(self))
    377         self._why_done = "cancelled"
     373        elif self.is_done and not self._why_done == "canceled":
     374            raise errors.InvalidJobStateException(self.state)
     375
     376        logger.info("canceled job %s" % str(self))
     377        self._why_done = "canceled"
    378378
    379379    def abort(self):
    380380        """Blocking abort. The job must not have been previously
    381         cancelled or completed (though this method will succeed if it
     381        canceled or completed (though this method will succeed if it
    382382        was previously aborted).  This should be used to stop the job
    383383        following internal errors.
  • server/lib/gutenbach/server/printer.py

    rb3a56af r97f20dd  
     1from . import sync
    12from .errors import InvalidJobException, InvalidPrinterStateException, InvalidJobStateException
    23from .job import GutenbachJob
     
    45import gutenbach.ipp as ipp
    56import logging
    6 import time
    7 import threading
    8 import traceback
     7import math
    98import sys
    109import tempfile
    11 from . import sync
    12 
     10import threading
     11import time
     12import traceback
    1313
    1414# initialize logger
     
    233233    @property
    234234    def printer_uri_supported(self):
     235        """RFC 2911: 4.4.1 printer-uri-supported (1setOf uri)
     236
     237        This REQUIRED Printer attribute contains at least one URI for
     238        the Printer object.  It OPTIONALLY contains more than one URI
     239        for the Printer object.  An administrator determines a Printer
     240        object's URI(s) and configures this attribute to contain those
     241        URIs by some means outside the scope of this IPP/1.1 document.
     242        The precise format of this URI is implementation dependent and
     243        depends on the protocol.  See the next two sections for a
     244        description of the 'uri-security-supported' and
     245        'uri-authentication-supported' attributes, both of which are
     246        the REQUIRED companion attributes to this 'printer-uri-
     247        supported' attribute.  See section 2.4 on Printer object
     248        identity and section 8.2 on security and URIs for more
     249        information.
     250
     251        """
    235252        self.assert_running()
    236253        return ipp.PrinterUriSupported(self.uri)
     
    242259    @property
    243260    def uri_authentication_supported(self):
     261        """RFC 2911: 4.4.2 uri-authentication-supported (1setOf type2
     262        keyword)
     263
     264        This REQUIRED Printer attribute MUST have the same cardinality
     265        (contain the same number of values) as the
     266        'printer-uri-supported' attribute.  This attribute identifies
     267        the Client Authentication mechanism associated with each URI
     268        listed in the 'printer-uri- supported' attribute. The Printer
     269        object uses the specified mechanism to identify the
     270        authenticated user (see section 8.3).  The 'i th' value in
     271        'uri-authentication-supported' corresponds to the 'i th' value
     272        in 'printer-uri-supported' and it describes the authentication
     273        mechanisms used by the Printer when accessed via that URI.
     274        See [RFC2910] for more details on Client Authentication.
     275
     276        The following standard keyword values are defined:
     277       
     278        'none': There is no authentication mechanism associated with
     279            the URI.  The Printer object assumes that the
     280            authenticated user is 'anonymous'.
     281
     282        'requesting-user-name': When a client performs an operation
     283            whose target is the associated URI, the Printer object
     284            assumes that the authenticated user is specified by the
     285            'requesting-user- name' Operation attribute (see section
     286            8.3). If the 'requesting-user-name' attribute is absent in
     287            a request, the Printer object assumes that the
     288            authenticated user is 'anonymous'.
     289
     290        'basic': When a client performs an operation whose target is
     291            the associated URI, the Printer object challenges the
     292            client with HTTP basic authentication [RFC2617]. The
     293            Printer object assumes that the authenticated user is the
     294            name received via the basic authentication mechanism.
     295
     296        'digest': When a client performs an operation whose target is
     297            the associated URI, the Printer object challenges the
     298            client with HTTP digest authentication [RFC2617]. The
     299            Printer object assumes that the authenticated user is the
     300            name received via the digest authentication mechanism.
     301
     302        'certificate': When a client performs an operation whose
     303            target is the associated URI, the Printer object expects
     304            the client to provide a certificate. The Printer object
     305            assumes that the authenticated user is the textual name
     306            contained within the certificate.
     307
     308        """
    244309        self.assert_running()
    245310        return ipp.UriAuthenticationSupported("none")
     
    251316    @property
    252317    def uri_security_supported(self):
     318        """RFC 2911: 4.4.3 uri-security-supported (1setOf type2
     319        keyword)
     320       
     321        This REQUIRED Printer attribute MUST have the same cardinality
     322        (contain the same number of values) as the
     323        'printer-uri-supported' attribute. This attribute identifies
     324        the security mechanisms used for each URI listed in the
     325        'printer-uri-supported' attribute. The 'i th' value in
     326        'uri-security-supported' corresponds to the 'i th' value in
     327        'printer-uri-supported' and it describes the security
     328        mechanisms used for accessing the Printer object via that
     329        URI. See [RFC2910] for more details on security mechanisms.
     330
     331        The following standard keyword values are defined:
     332
     333            'none': There are no secure communication channel
     334                    protocols in use for the given URI.
     335
     336            'ssl3': SSL3 [SSL] is the secure communications channel
     337                    protocol in use for the given URI.
     338
     339            'tls':  TLS [RFC2246] is the secure communications channel
     340                    protocol in use for the given URI.
     341
     342        This attribute is orthogonal to the definition of a Client
     343        Authentication mechanism. Specifically, 'none' does not
     344        exclude Client Authentication. See section 4.4.2.
     345
     346        Consider the following example. For a single Printer object,
     347        an administrator configures the 'printer-uri-supported', 'uri-
     348        authentication-supported' and 'uri-security-supported'
     349        attributes as follows:
     350
     351        'printer-uri-supported': 'xxx://acme.com/open-use-printer',
     352            'xxx://acme.com/restricted-use-printer',
     353            'xxx://acme.com/private-printer'
     354        'uri-authentication-supported': 'none', 'digest', 'basic'
     355        'uri-security-supported': 'none', 'none', 'tls'
     356
     357        Note: 'xxx' is not a valid scheme. See the IPP/1.1 'Transport
     358        and Encoding' document [RFC2910] for the actual URI schemes to
     359        be used in object target attributes.
     360
     361        In this case, one Printer object has three URIs.
     362
     363        - For the first URI, 'xxx://acme.com/open-use-printer', the
     364          value 'none' in 'uri-security-supported' indicates that
     365          there is no secure channel protocol configured to run under
     366          HTTP. The value of 'none' in 'uri-authentication-supported'
     367          indicates that all users are 'anonymous'. There will be no
     368          challenge and the Printer will ignore
     369          'requesting-user-name'.
     370
     371        - For the second URI, 'xxx://acme.com/restricted-use-printer',
     372          the value 'none' in 'uri-security-supported' indicates that
     373          there is no secure channel protocol configured to run under
     374          HTTP. The value of 'digest' in
     375          'uri-authentication-supported' indicates that the Printer
     376          will issue a challenge and that the Printer will use the
     377          name supplied by the digest mechanism to determine the
     378          authenticated user (see section 8.3).
     379
     380        - For the third URI, 'xxx://acme.com/private-printer', the
     381          value 'tls' in 'uri-security-supported' indicates that TLS
     382          is being used to secure the channel. The client SHOULD be
     383          prepared to use TLS framing to negotiate an acceptable
     384          ciphersuite to use while communicating with the Printer
     385          object. In this case, the name implies the use of a secure
     386          communications channel, but the fact is made explicit by the
     387          presence of the 'tls' value in 'uri-security-supported'. The
     388          client does not need to resort to understanding which
     389          security it must use by following naming conventions or by
     390          parsing the URI to determine which security mechanisms are
     391          implied. The value of 'basic' in 'uri-
     392          authentication-supported' indicates that the Printer will
     393          issue a challenge and that the Printer will use the name
     394          supplied by the digest mechanism to determine the
     395          authenticated user (see section 8.3). Because this challenge
     396          occurs in a tls session, the channel is secure.
     397
     398        It is expected that many IPP Printer objects will be
     399        configured to support only one channel (either configured to
     400        use TLS access or not) and only one authentication
     401        mechanism. Such Printer objects only have one URI listed in
     402        the 'printer-uri-supported' attribute. No matter the
     403        configuration of the Printer object (whether it has only one
     404        URI or more than one URI), a client MUST supply only one URI
     405        in the target 'printer-uri' operation attribute.
     406
     407        """
     408       
    253409        self.assert_running()
    254410        return ipp.UriSecuritySupported("none")
     
    260416    @property
    261417    def printer_name(self):
     418        """RFC 2911: 4.4.4 printer-name (name(127))
     419       
     420        This REQUIRED Printer attribute contains the name of the
     421        Printer object. It is a name that is more end-user friendly
     422        than a URI. An administrator determines a printer's name and
     423        sets this attribute to that name. This name may be the last
     424        part of the printer's URI or it may be unrelated. In
     425        non-US-English locales, a name may contain characters that are
     426        not allowed in a URI.
     427
     428        """
    262429        self.assert_running()
    263430        return ipp.PrinterName(self.name)
     
    268435
    269436    @property
     437    def printer_location(self):
     438        """RFC 2911: 4.4.5 printer-location (text(127))
     439
     440        This Printer attribute identifies the location of the
     441        device. This could include things like: 'in Room 123A, second
     442        floor of building XYZ'.
     443       
     444        """
     445        raise AttributeError # XXX
     446
     447    @property
     448    def printer_info(self):
     449        """RFC 2911: 4.4.6 printer-info (text(127))
     450
     451        This Printer attribute identifies the descriptive information
     452        about this Printer object. This could include things like:
     453        'This printer can be used for printing color transparencies
     454        for HR presentations', or 'Out of courtesy for others, please
     455        print only small (1-5 page) jobs at this printer', or even
     456        'This printer is going away on July 1, 1997, please find a new
     457        printer'.
     458       
     459        """
     460        raise AttributeError # XXX
     461
     462    @property
     463    def printer_more_info(self):
     464        """RFC 2911: 4.4.7 printer-more-info (uri)
     465
     466        This Printer attribute contains a URI used to obtain more
     467        information about this specific Printer object. For example,
     468        this could be an HTTP type URI referencing an HTML page
     469        accessible to a Web Browser.  The information obtained from
     470        this URI is intended for end user consumption. Features
     471        outside the scope of IPP can be accessed from this URI. The
     472        information is intended to be specific to this printer
     473        instance and site specific services (e.g. job pricing,
     474        services offered, end user assistance). The device
     475        manufacturer may initially populate this attribute.
     476
     477        """
     478        raise AttributeError # XXX
     479   
     480    @property
    270481    def printer_state(self):
     482        """RFC 2911: 4.4.11 printer-state (type1 enum)
     483       
     484        This REQUIRED Printer attribute identifies the current state
     485        of the device. The 'printer-state reasons' attribute augments
     486        the 'printer-state' attribute to give more detailed
     487        information about the Printer in the given printer state.
     488
     489        A Printer object need only update this attribute before
     490        responding to an operation which requests the attribute; the
     491        Printer object NEED NOT update this attribute continually,
     492        since asynchronous event notification is not part of
     493        IPP/1.1. A Printer NEED NOT implement all values if they are
     494        not applicable to a given implementation.  The following
     495        standard enum values are defined:
     496
     497        Value   Symbolic Name and Description
     498        ---------------------------------------------------------------
     499        '3'     'idle': Indicates that new jobs can start processing
     500                    without waiting.
     501        '4'     'processing': Indicates that jobs are processing; new
     502                    jobs will wait before processing.
     503        '5'     'stopped': Indicates that no jobs can be processed and
     504                    intervention is required.
     505
     506        Values of 'printer-state-reasons', such as 'spool-area-full'
     507        and 'stopped-partly', MAY be used to provide further
     508        information.
     509       
     510        """
    271511        self.assert_running()
    272512        return ipp.PrinterState(self.state)
     
    278518    @property
    279519    def printer_state_reasons(self):
     520        """RFC 2911: 4.4.12 printer-state-reasons (1setOf type2
     521        keyword)
     522
     523        This REQUIRED Printer attribute supplies additional detail
     524        about the device's state. Some of the these value definitions
     525        indicate conformance requirements; the rest are OPTIONAL.
     526        Each keyword value MAY have a suffix to indicate its level of
     527        severity. The three levels are: report (least severe),
     528        warning, and error (most severe).
     529
     530        - '-report': This suffix indicates that the reason is a
     531          'report'.  An implementation may choose to omit some or all
     532          reports. Some reports specify finer granularity about the
     533          printer state; others serve as a precursor to a warning. A
     534          report MUST contain nothing that could affect the printed
     535          output.
     536
     537        - '-warning': This suffix indicates that the reason is a
     538          'warning'. An implementation may choose to omit some or all
     539          warnings. Warnings serve as a precursor to an error. A
     540          warning MUST contain nothing that prevents a job from
     541          completing, though in some cases the output may be of lower
     542          quality.
     543
     544        - '-error': This suffix indicates that the reason is an
     545          'error'.  An implementation MUST include all errors. If this
     546          attribute contains one or more errors, printer MUST be in
     547          the stopped state.
     548
     549        If the implementation does not add any one of the three
     550        suffixes, all parties MUST assume that the reason is an
     551        'error'.
     552
     553        If a Printer object controls more than one output device, each
     554        value of this attribute MAY apply to one or more of the output
     555        devices. An error on one output device that does not stop the
     556        Printer object as a whole MAY appear as a warning in the
     557        Printer's 'printer-state-reasons attribute'. If the
     558        'printer-state' for such a Printer has a value of 'stopped',
     559        then there MUST be an error reason among the values in the
     560        'printer-state-reasons' attribute.
     561       
     562        """
    280563        self.assert_running()
    281564        return ipp.PrinterStateReasons("none")
     
    287570    @property
    288571    def ipp_versions_supported(self):
     572        """RFC 2911: 4.4.14 ipp-versions-supported (1setOf type2
     573        keyword)
     574
     575        This REQUIRED attribute identifies the IPP protocol version(s)
     576        that this Printer supports, including major and minor
     577        versions, i.e., the version numbers for which this Printer
     578        implementation meets the conformance requirements. For version
     579        number validation, the Printer matches the (two-octet binary)
     580        'version-number' parameter supplied by the client in each
     581        request (see sections 3.1.1 and 3.1.8) with the (US-ASCII)
     582        keyword values of this attribute.
     583
     584        The following standard keyword values are defined:
     585          '1.0': Meets the conformance requirement of IPP version 1.0
     586                as specified in RFC 2566 [RFC2566] and RFC 2565
     587                [RFC2565] including any extensions registered
     588                according to Section 6 and any extension defined in
     589                this version or any future version of the IPP 'Model
     590                and Semantics' document or the IPP 'Encoding and
     591                Transport' document following the rules, if any, when
     592                the 'version-number' parameter is '1.0'.
     593          '1.1': Meets the conformance requirement of IPP version 1.1
     594                 as specified in this document and [RFC2910] including
     595                 any extensions registered according to Section 6 and
     596                 any extension defined in any future versions of the
     597                 IPP 'Model and Semantics' document or the IPP
     598                 Encoding and Transport document following the rules,
     599                 if any, when the 'version-number' parameter is '1.1'.
     600       
     601        """
    289602        self.assert_running()
    290603        return ipp.IppVersionsSupported(*self.config['ipp-versions'])
     
    297610    @property
    298611    def operations_supported(self):
     612        """RFC 2911: 4.4.15 operations-supported (1setOf type2 enum)
     613
     614        This REQUIRED Printer attribute specifies the set of supported
     615        operations for this Printer object and contained Job objects.
     616        This attribute is encoded as any other enum attribute syntax
     617        according to [RFC2910] as 32-bits. However, all 32-bit enum
     618        values for this attribute MUST NOT exceed 0x00008FFF, since
     619        these same values are also passed in two octets in the
     620        'operation-id' parameter (see section 3.1.1) in each Protocol
     621        request with the two high order octets omitted in order to
     622        indicate the operation being performed [RFC2910].
     623
     624        """
    299625        self.assert_running()
    300626        return ipp.OperationsSupported(ipp.OperationCodes.GET_JOBS)
     
    305631
    306632    @property
     633    def multiple_document_jobs_supported(self):
     634        """RFC 2911: 4.4.16 multiple-document-jobs-supported (boolean)
     635
     636        This Printer attribute indicates whether or not the Printer
     637        supports more than one document per job, i.e., more than one
     638        Send-Document or Send-Data operation with document data. If
     639        the Printer supports the Create-Job and Send-Document
     640        operations (see section 3.2.4 and 3.3.1), it MUST support this
     641        attribute.
     642
     643        """
     644        self.assert_running()
     645        return ipp.MultipleDocumentJobsSupported(False)
     646    @multiple_document_jobs_supported.setter
     647    def multiple_document_jobs_supported(self, val):
     648        self.assert_running()
     649        raise ipp.errors.AttributesNotSettable("multiple-document-jobs-supported")
     650
     651    @property
    307652    def charset_configured(self):
     653        """RFC 2911: 4.4.17 charset-configured (charset)
     654
     655        This REQUIRED Printer attribute identifies the charset that
     656        the Printer object has been configured to represent 'text' and
     657        'name' Printer attributes that are set by the operator, system
     658        administrator, or manufacturer, i.e., for 'printer-name'
     659        (name), 'printer-location' (text), 'printer-info' (text), and
     660        'printer-make- and-model' (text). Therefore, the value of the
     661        Printer object's 'charset-configured' attribute MUST also be
     662        among the values of the Printer object's 'charset-supported'
     663        attribute.
     664
     665        """
    308666        self.assert_running()
    309667        return ipp.CharsetConfigured("utf-8") # XXX
     
    315673    @property
    316674    def charset_supported(self):
     675        """RFC 2911: 4.4.18 charset-supported (1setOf charset)
     676
     677        This REQUIRED Printer attribute identifies the set of charsets
     678        that the Printer and contained Job objects support in
     679        attributes with attribute syntax 'text' and 'name'. At least
     680        the value 'utf-8' MUST be present, since IPP objects MUST
     681        support the UTF-8 [RFC2279] charset. If a Printer object
     682        supports a charset, it means that for all attributes of syntax
     683        'text' and 'name' the IPP object MUST (1) accept the charset
     684        in requests and return the charset in responses as needed.
     685
     686        If more charsets than UTF-8 are supported, the IPP object MUST
     687        perform charset conversion between the charsets as described
     688        in Section 3.1.4.2.
     689
     690        """
    317691        self.assert_running()
    318692        return ipp.CharsetSupported("utf-8") # XXX
     
    324698    @property
    325699    def natural_language_configured(self):
     700        """RFC 2911: 4.4.19 natural-language-configured (naturalLanguage)
     701
     702        This REQUIRED Printer attribute identifies the natural
     703        language that the Printer object has been configured to
     704        represent 'text' and 'name' Printer attributes that are set by
     705        the operator, system administrator, or manufacturer, i.e., for
     706        'printer-name' (name), 'printer-location' (text),
     707        'printer-info' (text), and 'printer-make- and-model'
     708        (text). When returning these Printer attributes, the Printer
     709        object MAY return them in the configured natural language
     710        specified by this attribute, instead of the natural language
     711        requested by the client in the 'attributes-natural-language'
     712        operation attribute. See Section 3.1.4.1 for the specification
     713        of the OPTIONAL multiple natural language support. Therefore,
     714        the value of the Printer object's
     715        'natural-language-configured' attribute MUST also be among the
     716        values of the Printer object's 'generated-natural-
     717        language-supported' attribute.
     718
     719        """
    326720        self.assert_running()
    327721        return ipp.NaturalLanguageConfigured("en-us")
     
    333727    @property
    334728    def generated_natural_language_supported(self):
     729        """RFC 2911: 4.4.20 generated-natural-language-supported
     730        (1setOf naturalLanguage)
     731
     732        This REQUIRED Printer attribute identifies the natural
     733        language(s) that the Printer object and contained Job objects
     734        support in attributes with attribute syntax 'text' and
     735        'name'. The natural language(s) supported depends on
     736        implementation and/or configuration.  Unlike charsets, IPP
     737        objects MUST accept requests with any natural language or any
     738        Natural Language Override whether the natural language is
     739        supported or not.
     740
     741        If a Printer object supports a natural language, it means that
     742        for any of the attributes for which the Printer or Job object
     743        generates messages, i.e., for the 'job-state-message' and
     744        'printer-state- message' attributes and Operation Messages
     745        (see Section 3.1.5) in operation responses, the Printer and
     746        Job objects MUST be able to generate messages in any of the
     747        Printer's supported natural languages. See section 3.1.4 for
     748        the definition of 'text' and 'name' attributes in operation
     749        requests and responses.
     750       
     751        Note: A Printer object that supports multiple natural
     752        languages, often has separate catalogs of messages, one for
     753        each natural language supported.
     754
     755        """
    335756        self.assert_running()
    336757        return ipp.GeneratedNaturalLanguageSupported("en-us")
     
    342763    @property
    343764    def document_format_default(self):
     765        """RFC 2911: 4.4.21 document-format-default (mimeMediaType)
     766
     767        This REQUIRED Printer attribute identifies the document format
     768        that the Printer object has been configured to assume if the
     769        client does not supply a 'document-format' operation attribute
     770        in any of the operation requests that supply document
     771        data. The standard values for this attribute are Internet
     772        Media types (sometimes called MIME types). For further details
     773        see the description of the 'mimeMediaType' attribute syntax in
     774        Section 4.1.9.
     775
     776        """
    344777        self.assert_running()
    345778        return ipp.DocumentFormatDefault("application/octet-stream")
     
    351784    @property
    352785    def document_format_supported(self):
     786        """RFC 2911: 4.4.22 document-format-supported (1setOf mimeMediaType)
     787
     788        This REQUIRED Printer attribute identifies the set of document
     789        formats that the Printer object and contained Job objects can
     790        support. For further details see the description of the
     791        'mimeMediaType' attribute syntax in Section 4.1.9.
     792
     793        """
    353794        self.assert_running()
    354795        return ipp.DocumentFormatSupported("application/octet-stream", "audio/mp3")
     
    360801    @property
    361802    def printer_is_accepting_jobs(self):
    362         self.assert_running()
    363         return ipp.PrinterIsAcceptingJobs(True)
     803        """RFC 2911: 4.4.23 printer-is-accepting-jobs (boolean)
     804
     805        This REQUIRED Printer attribute indicates whether the printer
     806        is currently able to accept jobs, i.e., is accepting
     807        Print-Job, Print- URI, and Create-Job requests. If the value
     808        is 'true', the printer is accepting jobs. If the value is
     809        'false', the Printer object is currently rejecting any jobs
     810        submitted to it. In this case, the Printer object returns the
     811        'server-error-not-accepting-jobs' status code.
     812
     813        This value is independent of the 'printer-state' and
     814        'printer-state- reasons' attributes because its value does not
     815        affect the current job; rather it affects future jobs. This
     816        attribute, when 'false', causes the Printer to reject jobs
     817        even when the 'printer-state' is 'idle' or, when 'true',
     818        causes the Printer object to accepts jobs even when the
     819        'printer-state' is 'stopped'.
     820
     821        """
     822        self.assert_running()
     823        return ipp.PrinterIsAcceptingJobs(True) # XXX
    364824    @printer_is_accepting_jobs.setter
    365825    def printer_is_accepting_jobs(self, val):
     
    369829    @property
    370830    def queued_job_count(self):
     831        """RFC 2911: 4.4.24 queued-job-count (integer(0:MAX))
     832
     833        This REQUIRED Printer attribute contains a count of the number
     834        of jobs that are either 'pending', 'processing',
     835        'pending-held', or 'processing-stopped' and is set by the
     836        Printer object.
     837
     838        """
    371839        self.assert_running()
    372840        return ipp.QueuedJobCount(len(self.active_jobs))
     
    378846    @property
    379847    def pdl_override_supported(self):
     848        """RFC 2911: 4.4.28 pdl-override-supported (type2 keyword)
     849
     850        This REQUIRED Printer attribute expresses the ability for a
     851        particular Printer implementation to either attempt to
     852        override document data instructions with IPP attributes or
     853        not.
     854
     855        This attribute takes on the following keyword values:
     856
     857          - 'attempted': This value indicates that the Printer object
     858            attempts to make the IPP attribute values take precedence
     859            over embedded instructions in the document data, however
     860            there is no guarantee.
     861
     862          - 'not-attempted': This value indicates that the Printer
     863            object makes no attempt to make the IPP attribute values
     864            take precedence over embedded instructions in the document
     865            data.
     866
     867        Section 15 contains a full description of how this attribute
     868        interacts with and affects other IPP attributes, especially
     869        the 'ipp-attribute-fidelity' attribute.
     870
     871        """
    380872        self.assert_running()
    381873        return ipp.PdlOverrideSupported("not-attempted")
     
    387879    @property
    388880    def printer_up_time(self):
     881        """RFC 2911: 4.4.29 printer-up-time (integer(1:MAX))
     882
     883        This REQUIRED Printer attribute indicates the amount of time
     884        (in seconds) that this Printer instance has been up and
     885        running. The value is a monotonically increasing value
     886        starting from 1 when the Printer object is started-up
     887        (initialized, booted, etc.). This value is used to populate
     888        the Event Time Job Description Job attributes
     889        'time-at-creation', 'time-at-processing', and
     890        'time-at-completed' (see section 4.3.14).
     891
     892        If the Printer object goes down at some value 'n', and comes
     893        back up, the implementation MAY:
     894
     895            1. Know how long it has been down, and resume at some
     896               value greater than 'n', or
     897            2. Restart from 1.
     898
     899        In other words, if the device or devices that the Printer
     900        object is representing are restarted or power cycled, the
     901        Printer object MAY continue counting this value or MAY reset
     902        this value to 1 depending on implementation. However, if the
     903        Printer object software ceases running, and restarts without
     904        knowing the last value for 'printer- up-time', the
     905        implementation MUST reset this value to 1. If this value is
     906        reset and the Printer has persistent jobs, the Printer MUST
     907        reset the 'time-at-xxx(integer) Event Time Job Description
     908        attributes according to Section 4.3.14. An implementation MAY
     909        use both implementation alternatives, depending on warm versus
     910        cold start, respectively.
     911
     912        """
    389913        self.assert_running()
    390914        return ipp.PrinterUpTime(int(time.time()) - self.time_created)
     
    395919
    396920    @property
     921    def printer_current_time(self):
     922        """RFC 2911: 4.4.30 printer-current-time (dateTime)
     923       
     924        This Printer attribute indicates the current date and
     925        time. This value is used to populate the Event Time Job
     926        Description attributes: 'date-time-at-creation',
     927        'date-time-at-processing', and 'date-time- at-completed' (see
     928        Section 4.3.14).
     929
     930        The date and time is obtained on a 'best efforts basis' and
     931        does not have to be that precise in order to work in
     932        practice. A Printer implementation sets the value of this
     933        attribute by obtaining the date and time via some
     934        implementation-dependent means, such as getting the value from
     935        a network time server, initialization at time of manufacture,
     936        or setting by an administrator. See [IPP-IIG] for examples. If
     937        an implementation supports this attribute and the
     938        implementation knows that it has not yet been set, then the
     939        implementation MUST return the value of this attribute using
     940        the out-of-band 'no-value' meaning not configured. See the
     941        beginning of section 4.1.
     942
     943        The time zone of this attribute NEED NOT be the time zone used
     944        by people located near the Printer object or device. The
     945        client MUST NOT expect that the time zone of any received
     946        'dateTime' value to be in the time zone of the client or in
     947        the time zone of the people located near the printer.
     948
     949        The client SHOULD display any dateTime attributes to the user
     950        in client local time by converting the 'dateTime' value
     951        returned by the server to the time zone of the client, rather
     952        than using the time zone returned by the Printer in attributes
     953        that use the 'dateTime' attribute syntax.
     954
     955        """
     956        raise AttributeError # XXX
     957
     958    @property
     959    def multiple_operation_time_out(self):
     960        """RFC 2911: 4.4.31 multiple-operation-time-out
     961        (integer(1:MAX))
     962
     963        This Printer attributes identifies the minimum time (in
     964        seconds) that the Printer object waits for additional
     965        Send-Document or Send-URI operations to follow a still-open
     966        Job object before taking any recovery actions, such as the
     967        ones indicated in section 3.3.1. If the Printer object
     968        supports the Create-Job and Send-Document operations (see
     969        section 3.2.4 and 3.3.1), it MUST support this attribute.
     970
     971        It is RECOMMENDED that vendors supply a value for this
     972        attribute that is between 60 and 240 seconds. An
     973        implementation MAY allow a system administrator to set this
     974        attribute (by means outside this IPP/1.1 document). If so, the
     975        system administrator MAY be able to set values outside this
     976        range.
     977
     978        """
     979        self.assert_running()
     980        return ipp.MultipleOperationTimeOut(240)
     981    @multiple_operation_time_out.setter
     982    def multiple_operation_time_out(self, val):
     983        self.assert_running()
     984        raise ipp.errors.AttributesNotSettable("multiple-operation-time-out")
     985
     986    @property
    397987    def compression_supported(self):
     988        """RFC 2911: 4.4.32 compression-supported (1setOf type3
     989        keyword)
     990
     991        This REQUIRED Printer attribute identifies the set of
     992        supported compression algorithms for document
     993        data. Compression only applies to the document data;
     994        compression does not apply to the encoding of the IPP
     995        operation itself. The supported values are used to validate
     996        the client supplied 'compression' operation attributes in
     997        Print-Job, Send-Document, and Send-URI requests.
     998
     999        Standard keyword values are :
     1000            'none': no compression is used.
     1001            'deflate': ZIP public domain inflate/deflate) compression
     1002                technology in RFC 1951 [RFC1951]
     1003            'gzip' GNU zip compression technology described in RFC
     1004                1952 [RFC1952].
     1005            'compress': UNIX compression technology in RFC 1977 [RFC1977]
     1006
     1007        """
    3981008        self.assert_running()
    3991009        return ipp.CompressionSupported("none")
     
    4031013        raise ipp.errors.AttributesNotSettable("compression-supported")
    4041014
    405     @property
    406     def multiple_operation_time_out(self):
    407         self.assert_running()
    408         return ipp.MultipleOperationTimeOut(240)
    409     @multiple_operation_time_out.setter
    410     def multiple_operation_time_out(self, val):
    411         self.assert_running()
    412         raise ipp.errors.AttributesNotSettable("multiple-operation-time-out")
    413 
    414     @property
    415     def multiple_document_jobs_supported(self):
    416         self.assert_running()
    417         return ipp.MultipleDocumentJobsSupported(False)
    418     @multiple_document_jobs_supported.setter
    419     def multiple_document_jobs_supported(self, val):
    420         self.assert_running()
    421         raise ipp.errors.AttributesNotSettable("multiple-document-jobs-supported")
    422 
    4231015    ######################################################################
    4241016    ###                      Job IPP Attributes                        ###
    4251017    ######################################################################
    4261018
     1019    def job_uri(self, job_id):
     1020        """RFC 2911: 4.3.1 job-uri (uri)
     1021
     1022        This REQUIRED attribute contains the URI for the job. The
     1023        Printer object, on receipt of a new job, generates a URI which
     1024        identifies the new Job. The Printer object returns the value
     1025        of the 'job-uri' attribute as part of the response to a create
     1026        request. The precise format of a Job URI is implementation
     1027        dependent. If the Printer object supports more than one URI
     1028        and there is some relationship between the newly formed Job
     1029        URI and the Printer object's URI, the Printer object uses the
     1030        Printer URI supplied by the client in the create request. For
     1031        example, if the create request comes in over a secure channel,
     1032        the new Job URI MUST use the same secure channel.  This can be
     1033        guaranteed because the Printer object is responsible for
     1034        generating the Job URI and the Printer object is aware of its
     1035        security configuration and policy as well as the Printer URI
     1036        used in the create request.
     1037
     1038        For a description of this attribute and its relationship to
     1039        'job-id' and 'job-printer-uri' attribute, see the discussion
     1040        in section 2.4 on 'Object Identity'.
     1041
     1042        """
     1043        raise AttributeError # XXX
     1044
    4271045    def job_id(self, job_id):
     1046        """RFC 2911: 4.3.2 job-id (integer(1:MAX))
     1047
     1048        This REQUIRED attribute contains the ID of the job. The
     1049        Printer, on receipt of a new job, generates an ID which
     1050        identifies the new Job on that Printer. The Printer returns
     1051        the value of the 'job-id' attribute as part of the response to
     1052        a create request. The 0 value is not included to allow for
     1053        compatibility with SNMP index values which also cannot be 0.
     1054
     1055        For a description of this attribute and its relationship to
     1056        'job-uri' and 'job-printer-uri' attribute, see the discussion
     1057        in section 2.4 on 'Object Identity'.
     1058
     1059        """
    4281060        self.assert_running()
    4291061        job = self.get_job(job_id)
    4301062        return ipp.JobId(job.id)
    4311063
     1064    def job_printer_uri(self, job_id):
     1065        """RFC 2911: 4.3.3 job-printer-uri (uri)
     1066
     1067        This REQUIRED attribute identifies the Printer object that
     1068        created this Job object. When a Printer object creates a Job
     1069        object, it populates this attribute with the Printer object
     1070        URI that was used in the create request. This attribute
     1071        permits a client to identify the Printer object that created
     1072        this Job object when only the Job object's URI is available to
     1073        the client. The client queries the creating Printer object to
     1074        determine which languages, charsets, operations, are supported
     1075        for this Job.
     1076
     1077        For a description of this attribute and its relationship to
     1078        'job-uri' and 'job-id' attribute, see the discussion in
     1079        section 2.4 on 'Object Identity'.
     1080
     1081        """
     1082        self.assert_running()
     1083        job = self.get_job(job_id)
     1084        return ipp.JobPrinterUri(self.uri)
     1085
    4321086    def job_name(self, job_id):
     1087        """RFC 2911: 4.3.5 job-name (name(MAX))
     1088
     1089        This REQUIRED attribute is the name of the job. It is a name
     1090        that is more user friendly than the 'job-uri' attribute
     1091        value. It does not need to be unique between Jobs. The Job's
     1092        'job-name' attribute is set to the value supplied by the
     1093        client in the 'job-name' operation attribute in the create
     1094        request (see Section 3.2.1.1).
     1095
     1096        If, however, the 'job-name' operation attribute is not
     1097        supplied by the client in the create request, the Printer
     1098        object, on creation of the Job, MUST generate a name. The
     1099        printer SHOULD generate the value of the Job's 'job-name'
     1100        attribute from the first of the following sources that
     1101        produces a value: 1) the 'document-name' operation attribute
     1102        of the first (or only) document, 2) the 'document-URI'
     1103        attribute of the first (or only) document, or 3) any other
     1104        piece of Job specific and/or Document Content information.
     1105       
     1106        """
    4331107        self.assert_running()
    4341108        job = self.get_job(job_id)
     
    4361110
    4371111    def job_originating_user_name(self, job_id):
     1112        """RFC 2911: 4.3.6 job-originating-user-name (name(MAX))
     1113
     1114        This REQUIRED attribute contains the name of the end user that
     1115        submitted the print job. The Printer object sets this
     1116        attribute to the most authenticated printable name that it can
     1117        obtain from the authentication service over which the IPP
     1118        operation was received.  Only if such is not available, does
     1119        the Printer object use the value supplied by the client in the
     1120        'requesting-user-name' operation attribute of the create
     1121        operation (see Sections 4.4.2, 4.4.3, and 8).
     1122
     1123        Note: The Printer object needs to keep an internal originating
     1124        user id of some form, typically as a credential of a
     1125        principal, with the Job object. Since such an internal
     1126        attribute is implementation- dependent and not of interest to
     1127        clients, it is not specified as a Job Description
     1128        attribute. This originating user id is used for authorization
     1129        checks (if any) on all subsequent operations.
     1130
     1131        """
    4381132        self.assert_running()
    4391133        job = self.get_job(job_id)
    4401134        return ipp.JobOriginatingUserName(job.creator)
    4411135
    442     def job_k_octets(self, job_id):
    443         self.assert_running()
    444         job = self.get_job(job_id)
    445         return ipp.JobKOctets(job.size)
    446 
    4471136    def job_state(self, job_id):
     1137        """RFC 2911: 4.3.7 job-state (type1 enum)
     1138
     1139        This REQUIRED attribute identifies the current state of the
     1140        job.  Even though the IPP protocol defines seven values for
     1141        job states (plus the out-of-band 'unknown' value - see Section
     1142        4.1), implementations only need to support those states which
     1143        are appropriate for the particular implementation. In other
     1144        words, a Printer supports only those job states implemented by
     1145        the output device and available to the Printer object
     1146        implementation.  Standard enum values are:
     1147
     1148            '3' 'pending': The job is a candidate to start processing,
     1149                but is not yet processing.
     1150
     1151            '4' 'pending-held': The job is not a candidate for
     1152                processing for any number of reasons but will return
     1153                to the 'pending' state as soon as the reasons are no
     1154                longer present. The job's 'job-state-reason' attribute
     1155                MUST indicate why the job is no longer a candidate for
     1156                processing.
     1157
     1158            '5' 'processing': One or more of:
     1159
     1160                1. the job is using, or is attempting to use, one or
     1161                   more purely software processes that are analyzing,
     1162                   creating, or interpreting a PDL, etc.,
     1163                2. the job is using, or is attempting to use, one or
     1164                   more hardware devices that are interpreting a PDL,
     1165                   making marks on a medium, and/or performing
     1166                   finishing, such as stapling, etc.,
     1167                3. the Printer object has made the job ready for
     1168                   printing, but the output device is not yet printing
     1169                   it, either because the job hasn't reached the
     1170                   output device or because the job is queued in the
     1171                   output device or some other spooler, awaiting the
     1172                   output device to print it.
     1173
     1174                When the job is in the 'processing' state, the entire
     1175                job state includes the detailed status represented in
     1176                the Printer object's 'printer-state', 'printer-state-
     1177                reasons', and 'printer-state-message' attributes.
     1178
     1179                Implementations MAY, though they NEED NOT, include
     1180                additional values in the job's 'job-state-reasons'
     1181                attribute to indicate the progress of the job, such as
     1182                adding the 'job-printing' value to indicate when the
     1183                output device is actually making marks on paper and/or
     1184                the 'processing-to-stop-point' value to indicate that
     1185                the IPP object is in the process of canceling or
     1186                aborting the job. Most implementations won't bother
     1187                with this nuance.
     1188
     1189            '6' 'processing-stopped': The job has stopped while
     1190                processing for any number of reasons and will return
     1191                to the 'processing' state as soon as the reasons are
     1192                no longer present.
     1193
     1194                The job's 'job-state-reason' attribute MAY indicate
     1195                why the job has stopped processing. For example, if
     1196                the output device is stopped, the 'printer-stopped'
     1197                value MAY be included in the job's 'job-state-reasons'
     1198                attribute.
     1199
     1200                Note: When an output device is stopped, the device
     1201                usually indicates its condition in human readable form
     1202                locally at the device. A client can obtain more
     1203                complete device status remotely by querying the
     1204                Printer object's 'printer-state',
     1205                'printer-state-reasons' and 'printer- state-message'
     1206                attributes.
     1207
     1208            '7' 'canceled': The job has been canceled by a Cancel-Job
     1209                operation and the Printer object has completed
     1210                canceling the job and all job status attributes have
     1211                reached their final values for the job. While the
     1212                Printer object is canceling the job, the job remains
     1213                in its current state, but the job's
     1214                'job-state-reasons' attribute SHOULD contain the
     1215                'processing-to-stop-point' value and one of the
     1216                'canceled-by-user', 'canceled-by-operator', or
     1217                'canceled-at-device' value. When the job moves to the
     1218                'canceled' state, the 'processing-to-stop-point'
     1219                value, if present, MUST be removed, but the
     1220                'canceled-by-xxx', if present, MUST remain.
     1221
     1222            '8' 'aborted': The job has been aborted by the system,
     1223                usually while the job was in the 'processing' or
     1224                'processing- stopped' state and the Printer has
     1225                completed aborting the job and all job status
     1226                attributes have reached their final values for the
     1227                job. While the Printer object is aborting the job, the
     1228                job remains in its current state, but the job's
     1229                'job-state-reasons' attribute SHOULD contain the
     1230                'processing-to-stop-point' and 'aborted-by- system'
     1231                values. When the job moves to the 'aborted' state, the
     1232                'processing-to-stop-point' value, if present, MUST be
     1233                removed, but the 'aborted-by-system' value, if
     1234                present, MUST remain.
     1235
     1236            '9' 'completed': The job has completed successfully or
     1237                with warnings or errors after processing and all of
     1238                the job media sheets have been successfully stacked in
     1239                the appropriate output bin(s) and all job status
     1240                attributes have reached their final values for the
     1241                job. The job's 'job-state-reasons' attribute SHOULD
     1242                contain one of: 'completed-successfully',
     1243                'completed-with-warnings', or 'completed-with-errors'
     1244                values.
     1245
     1246        The final value for this attribute MUST be one of:
     1247        'completed', 'canceled', or 'aborted' before the Printer
     1248        removes the job altogether. The length of time that jobs
     1249        remain in the 'canceled', 'aborted', and 'completed' states
     1250        depends on implementation. See section 4.3.7.2.
     1251
     1252        The following figure shows the normal job state transitions.
     1253       
     1254                                                           +----> canceled
     1255                                                          /
     1256            +----> pending --------> processing ---------+------> completed
     1257            |         ^                   ^               \
     1258        --->+         |                   |                +----> aborted
     1259            |         v                   v               /
     1260            +----> pending-held    processing-stopped ---+
     1261
     1262        Normally a job progresses from left to right. Other state
     1263        transitions are unlikely, but are not forbidden. Not shown are
     1264        the transitions to the 'canceled' state from the 'pending',
     1265        'pending- held', and 'processing-stopped' states.
     1266
     1267        Jobs reach one of the three terminal states: 'completed',
     1268        'canceled', or 'aborted', after the jobs have completed all
     1269        activity, including stacking output media, after the jobs have
     1270        completed all activity, and all job status attributes have
     1271        reached their final values for the job.
     1272
     1273        """
    4481274        self.assert_running()
    4491275        job = self.get_job(job_id)
    4501276        return ipp.JobState(job.state)
    4511277
    452     def job_printer_uri(self, job_id):
     1278    def job_k_octets(self, job_id):
     1279        """RFC 2911: 4.3.17.1 job-k-octets (integer(0:MAX))
     1280
     1281        This attribute specifies the total size of the document(s) in
     1282        K octets, i.e., in units of 1024 octets requested to be
     1283        processed in the job. The value MUST be rounded up, so that a
     1284        job between 1 and 1024 octets MUST be indicated as being 1,
     1285        1025 to 2048 MUST be 2, etc.
     1286
     1287        This value MUST NOT include the multiplicative factors
     1288        contributed by the number of copies specified by the 'copies'
     1289        attribute, independent of whether the device can process
     1290        multiple copies without making multiple passes over the job or
     1291        document data and independent of whether the output is
     1292        collated or not. Thus the value is independent of the
     1293        implementation and indicates the size of the document(s)
     1294        measured in K octets independent of the number of copies.
     1295
     1296        This value MUST also not include the multiplicative factor due
     1297        to a copies instruction embedded in the document data. If the
     1298        document data actually includes replications of the document
     1299        data, this value will include such replication. In other
     1300        words, this value is always the size of the source document
     1301        data, rather than a measure of the hardcopy output to be
     1302        produced.
     1303
     1304        """
    4531305        self.assert_running()
    4541306        job = self.get_job(job_id)
    455         return ipp.JobPrinterUri(self.uri)
     1307        return ipp.JobKOctets(int(math.ceil(job.size / 1024.)))
     1308
     1309    def job_k_octets_completed(self, job_id):
     1310        """RFC 2911: 4.3.18.1 job-k-octets-processed (integer(0:MAX))
     1311
     1312        This attribute specifies the total number of octets processed
     1313        in K octets, i.e., in units of 1024 octets so far. The value
     1314        MUST be rounded up, so that a job between 1 and 1024 octets
     1315        inclusive MUST be indicated as being 1, 1025 to 2048 inclusive
     1316        MUST be 2, etc.  For implementations where multiple copies are
     1317        produced by the interpreter with only a single pass over the
     1318        data, the final value MUST be equal to the value of the
     1319        'job-k-octets' attribute. For implementations where multiple
     1320        copies are produced by the interpreter by processing the data
     1321        for each copy, the final value MUST be a multiple of the value
     1322        of the 'job-k-octets' attribute.
     1323
     1324        """
     1325        raise AttributeError # XXX
     1326
     1327    def attributes_charset(self, job_id):
     1328        """RFC 2911: 4.3.19 attributes-charset (charset)
     1329
     1330        This REQUIRED attribute is populated using the value in the
     1331        client supplied 'attributes-charset' attribute in the create
     1332        request. It identifies the charset (coded character set and
     1333        encoding method) used by any Job attributes with attribute
     1334        syntax 'text' and 'name' that were supplied by the client in
     1335        the create request. See Section 3.1.4 for a complete
     1336        description of the 'attributes-charset' operation attribute.
     1337
     1338        This attribute does not indicate the charset in which the
     1339        'text' and 'name' values are stored internally in the Job
     1340        object. The internal charset is implementation-defined. The
     1341        IPP object MUST convert from whatever the internal charset is
     1342        to that being requested in an operation as specified in
     1343        Section 3.1.4.
     1344
     1345        """
     1346        raise AttributeError # XXX
     1347
     1348    def attributes_natural_language(self, job_id):
     1349        """RFC 2911: 4.3.20 attributes-natural-language
     1350        (naturalLanguage)
     1351
     1352        This REQUIRED attribute is populated using the value in the
     1353        client supplied 'attributes-natural-language' attribute in the
     1354        create request. It identifies the natural language used for
     1355        any Job attributes with attribute syntax 'text' and 'name'
     1356        that were supplied by the client in the create request. See
     1357        Section 3.1.4 for a complete description of the
     1358        'attributes-natural-language' operation attribute. See
     1359        Sections 4.1.1.2 and 4.1.2.2 for how a Natural Language
     1360        Override may be supplied explicitly for each 'text' and 'name'
     1361        attribute value that differs from the value identified by the
     1362        'attributes-natural-language' attribute.
     1363
     1364        """
     1365        raise AttributeError # XXX
    4561366
    4571367    ######################################################################
  • server/lib/gutenbach_test/server/job.py

    r5ffffe0 r97f20dd  
    3636        self.assertEqual(self.job.size, 0)
    3737    def testState(self):
    38         self.assertEqual(self.job.state, States.HELD)
     38        self.assertEqual(self.job.state, States.PENDING_HELD)
    3939    def testPriority(self):
    4040        self.assertEqual(self.job.priority, 1)
     
    4747        self.assertFalse(self.job.is_done)
    4848        self.assertFalse(self.job.is_completed)
    49         self.assertFalse(self.job.is_cancelled)
     49        self.assertFalse(self.job.is_canceled)
    5050        self.assertFalse(self.job.is_aborted)
    5151
     
    6060    def testCancel(self):
    6161        self.job.cancel()
    62         self.assertTrue(self.job.is_cancelled)
    63         self.assertEqual(self.job.state, States.CANCELLED)
     62        self.assertTrue(self.job.is_canceled)
     63        self.assertEqual(self.job.state, States.CANCELED)
    6464    def testAbort(self):
    6565        self.job.abort()
     
    157157        self.assertTrue(self.job.is_completed)
    158158        self.assertFalse(self.job.is_aborted)
    159         self.assertFalse(self.job.is_cancelled)
     159        self.assertFalse(self.job.is_canceled)
    160160
    161161    def testPause(self):
     
    182182        self.assertTrue(self.job.is_completed)
    183183        self.assertFalse(self.job.is_aborted)
    184         self.assertFalse(self.job.is_cancelled)
     184        self.assertFalse(self.job.is_canceled)
    185185
    186186    def testCancel(self):
    187187        self.job.play()
    188188        self.assertTrue(self.job.is_playing)
    189         self.assertFalse(self.job.is_cancelled)
     189        self.assertFalse(self.job.is_canceled)
    190190
    191191        self.job.cancel()
    192192        self.assertFalse(self.job.is_playing)
    193193        self.assertTrue(self.job.is_done)
    194         self.assertTrue(self.job.is_cancelled)
     194        self.assertTrue(self.job.is_canceled)
    195195        self.assertFalse(self.job.is_aborted)
    196196
     
    203203        self.assertFalse(self.job.is_playing)
    204204        self.assertTrue(self.job.is_done)
    205         self.assertFalse(self.job.is_cancelled)
     205        self.assertFalse(self.job.is_canceled)
    206206        self.assertTrue(self.job.is_aborted)
    207207
     
    218218        self.assertFalse(self.job.is_playing)
    219219        self.assertTrue(self.job.is_done)
    220         self.assertTrue(self.job.is_cancelled)
     220        self.assertTrue(self.job.is_canceled)
    221221        self.assertFalse(self.job.is_aborted)
    222222
Note: See TracChangeset for help on using the changeset viewer.