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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.