Changeset 4914b47


Ignore:
Timestamp:
Jan 21, 2012, 5:10:46 PM (12 years ago)
Author:
Daniel Cooper <danny@…>
Branches:
no-cups
Children:
f70792f
Parents:
72c3fcb
git-author:
Daniel Cooper <danny@…> (01/21/12 17:10:46)
git-committer:
Daniel Cooper <danny@…> (01/21/12 17:10:46)
Message:

added most of print_job

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach/server/requests.py

    r72c3fcb r4914b47  
    169169
    170170        """
     171        operation = request.attribute_groups[0]
     172        # requested printer uri
     173        if 'printer-uri' not in operation:
     174            raise ipp.errors.ClientErrorBadRequest("Missing 'printer-uri' attribute")
     175        printer_uri = verify_attribute(operation['printer-uri'], ipp.PrinterUri)[0]
     176        if printer_uri not in self.printer.uris:
     177            raise ipp.errors.ClientErrorAttributes(
     178                str(operation['printer-uri']), operation['printer-uri'])
     179
     180        if 'requesting-user-name' in operation:
     181            user_name = verify_attribute(
     182                operation['requesting-user-name'], ipp.RequestingUserName)[0]
     183
     184        if 'job-name' in operation:
     185            job_name = verify_attribute(
     186                operation['job-name'], ipp.JobName)[0]
     187
     188        if 'job-k-octets' in operation:
     189            job_k_octets = verify_attribute(
     190                operation['job-k-octets'], ipp.JobKOctets)[0]
     191
     192        if 'ipp-attribute-fidelity' in operation:
     193            pass # don't care
     194        if 'job-impressions' in operation:
     195            pass # don't care
     196        if 'job-media-sheets' in operation:
     197            pass # don't care
     198
     199        # get attributes from the printer and add to response
     200        job_id = self.printer.create_job(
     201            requesting_user_name=requesting_user_name,
     202            job_name=job_name,
     203            job_k_octets=job_k_octets)
     204        attrs = self.printer.get_job_attributes(job_id)
     205        response.attribute_groups.append(ipp.AttributeGroup(
     206            ipp.AttributeTags.JOB, attrs))
     207            #raise ipp.errors.ServerErrorOperationNotSupported
     208        # Get nescessary information for calling send_document
     209        # Any field being set to None here just means that we either aren't using or haven't implemented parsing it
     210        document = request.attribute_groups[2]
     211        #XXX
     212        document_format = None
     213        document_natural_language = None
     214        compression = None
     215        last_document = None
     216
     217
    171218       
    172         raise ipp.errors.ServerErrorOperationNotSupported
    173 
     219        # Actually put the document in the job
     220        self.printer.send_document(job_id,document,
     221                document_name = document_name,
     222                document_format = document_format,
     223                document_natural_language = document_natural_language,
     224                requesting_user_name = requesting_user_name,
     225                compression = compression,
     226                last_document = last_document)
     227        #fix this once jess pushes
     228        self.print_job()
    174229    @handler_for(ipp.OperationCodes.VALIDATE_JOB)
    175230    def validate_job(self, request, response):
Note: See TracChangeset for help on using the changeset viewer.