Changeset 59a1d4a for server


Ignore:
Timestamp:
Dec 20, 2011, 3:20:13 PM (12 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
no-cups
Children:
aef164a
Parents:
ef8df33
git-author:
Jessica B. Hamrick <jhamrick@…> (12/20/11 15:20:13)
git-committer:
Jessica B. Hamrick <jhamrick@…> (12/20/11 15:20:13)
Message:

A litte bit of documentation

Location:
server/lib/gutenbach
Files:
2 edited

Legend:

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

    ref8df33 r59a1d4a  
    2121        raise err.VersionNotSupported(str(request.version))
    2222
    23     # check operation id
     23    # XXX: check operation id
    2424    if False:
    2525        raise err.OperationNotSupported(str(request.operation_id))
     
    3131            "Attribute group does not have OPERATION tag: 0x%x" % op_attrs.tag)
    3232
     33    # XXX: if these aren't valid, then you HAVE to return something
     34    # special.  See RFC 2911 3.1.6.1
    3335    # # check compression
    3436    # if False:
     
    474476    return out
    475477
    476 
    477478def make_get_printer_attributes_response(attrs, request):
    478479    """3.2.5.2 Get-Printer-Attributes Response
     
    525526    return response
    526527
     528### CUPS-GET-DEFAULT
    527529
    528530def verify_cups_get_default_request(request):
     
    576578    make_printer_attributes(attrs, request, response)
    577579    return response
     580
     581### CUPS-GET-PRINTERS
    578582
    579583def verify_cups_get_printers_request(request):
     
    619623    """
    620624
     625    # XXX: actually do something here
    621626    return {}
    622627
     
    648653        make_printer_attributes(printer, request, response)
    649654    return response
     655
     656### CUPS-GET-CLASSES
    650657
    651658def verify_cups_get_classes_request(request):
     
    692699    """
    693700
     701    # XXX: actually do something here
    694702    return {}
    695703
  • server/lib/gutenbach/server/requests.py

    ref8df33 r59a1d4a  
    7373
    7474        """
    75        
     75
     76        # verify the request and get an attribute dictionary
    7677        req_dict = ipp.ops.verify_get_jobs_request(request)
     78
     79        # lookup printer name
    7780        printer_name = req_dict['printer-uri']
    7881        if printer_name not in self.printers:
     
    8184                [request.attribute_groups[0].attributes[2]])
    8285
    83         # Each job will append a new job attribute group.
     86        # get the job attributes
    8487        jobs = [job.get_job_attributes(request) for job in \
    8588                self.printers[printer_name].get_jobs()]
     89
     90        # build the response
    8691        response = ipp.ops.make_get_jobs_response(jobs, request)
    8792        return response
     
    143148        """
    144149
    145         # this is just like cups_get_default, except the printer name
    146         # is given
     150        # verify the request and get the attributes dictionary
    147151        req_dict = ipp.ops.verify_get_printer_attributes_request(request)
     152
     153        # lookup the printer name
    148154        printer_name = req_dict['printer-uri']
    149155        if printer_name not in self.printers:
     
    151157                "Invalid printer uri: %s" % printer_name,
    152158                [request.attribute_groups[0].attributes[2]])
    153        
     159
     160        # bulid response
    154161        response = ipp.ops.make_get_printer_attributes_response(
    155162            self.printers[printer_name].get_printer_attributes(request), request)
     
    171178
    172179    def get_job_attributes(self, request):
     180       
     181        # verify the request and get the attributes dictionary
    173182        req_dict = ipp.ops.verify_get_jobs_request(request)
     183       
     184        # lookup the printer name
    174185        printer_name = req_dict['printer-uri']
    175         job_id = req_dict['job-id']
    176        
    177186        if printer_name not in self.printers:
    178187            raise ipp.errors.Attributes(
    179188                "Invalid printer uri: %s" % printer_name,
    180189                [request.attribute_groups[0].attributes[2]])
    181         try:
    182             job = self.printers[printer_name].get_job(job_id)
     190
     191        # lookup the job id
     192        job_id = req_dict['job-id']
     193        try: job = self.printers[printer_name].get_job(job_id)
    183194        except InvalidJobException:
    184195            raise ipp.errors.Attributes(
     
    186197                [request.attribute_groups[0].attributes[2]]) # XXX: this is wrong
    187198
    188         # Each job will append a new job attribute group.
    189199        # XXX: we need to honor the things that the request actually asks for
     200        # build the response
    190201        response = ipp.ops.make_get_job_attributes_response(
    191202            job.get_job_attributes(request), request)
     
    215226        """
    216227
     228        # verify the request and get the attributes dictionary
    217229        req_dict = ipp.ops.verify_cups_get_default_request(request)
     230        # build the response
    218231        response = ipp.ops.make_get_printer_attributes_response(
    219232            self.printers[self.default].get_printer_attributes(request), request)
     
    231244        """
    232245
     246        # verify the request and get the attributes dictionary
    233247        req_dict = ipp.ops.verify_cups_get_printers_request(request)
     248        # get the printer attributes
    234249        attrs = [self.printers[printer].get_printer_attributes(request) \
    235250                 for printer in self.printers]
     251        # build the response
    236252        response = ipp.ops.make_cups_get_printers_response(attrs, request)
    237253        return response
     
    248264        """
    249265
     266        # verify the request and get the attributes dictionaryu
    250267        req_dict = ipp.ops.verify_cups_get_classes_request(request)
     268        # build the response
    251269        response = ipp.ops.make_cups_get_classes_response(request)
    252270        return response
Note: See TracChangeset for help on using the changeset viewer.