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

Fix some errors in server/, handle fatal errors better

File:
1 edited

Legend:

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

    r5fe360e r6effd50  
    6161    def __getattr__(self, attr):
    6262        try:
    63             return super(Printer, self).__getattr__(attr)
     63            return self.__getattribute__(attr)
    6464        except AttributeError:
    6565            pass
    66 
    67         return super(Printer, self).__getattr__(
    68             attr.replace("-", "_"))
     66        return self.__getattribute__(attr.replace("-", "_"))
    6967
    7068    def __hasattr__(self, attr):
    71         has = super(Printer, self).__hasattr__(attr)
    72         if not has:
    73             has = super(Printer, self).__hasattr__(
    74                 attr.replace("-", "_"))
    75         return has
     69        try:
     70            getattr(self, attr)
     71            return True
     72        except AttributeError:
     73            return False
    7674
    7775    ## Printer attributes
     
    156154    def get_printer_attributes(self, request):
    157155        attributes = [(attr, getattr(self, attr)) for attr in self.attributes]
    158         attributes = map(lambda x: x if isinstance(x, (tuple, list)) else [x], attributes)
     156        attributes = map(lambda x: x if isinstance(x[1], (tuple, list)) else (x[0], [x[1]]),
     157                         attributes)
    159158        return attributes
    160159
Note: See TracChangeset for help on using the changeset viewer.