Changeset 6effd50 for server/lib/gutenbach/server/printer.py
- Timestamp:
- Dec 20, 2011, 1:47:35 PM (12 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/printer.py
r5fe360e r6effd50 61 61 def __getattr__(self, attr): 62 62 try: 63 return s uper(Printer, self).__getattr__(attr)63 return self.__getattribute__(attr) 64 64 except AttributeError: 65 65 pass 66 67 return super(Printer, self).__getattr__( 68 attr.replace("-", "_")) 66 return self.__getattribute__(attr.replace("-", "_")) 69 67 70 68 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 has69 try: 70 getattr(self, attr) 71 return True 72 except AttributeError: 73 return False 76 74 77 75 ## Printer attributes … … 156 154 def get_printer_attributes(self, request): 157 155 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) 159 158 return attributes 160 159
Note: See TracChangeset
for help on using the changeset viewer.