~ubuntu-branches/ubuntu/utopic/hplip/utopic-proposed

« back to all changes in this revision

Viewing changes to base/device.py

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-01-08 20:10:45 UTC
  • mfrom: (2.1.182 precise)
  • Revision ID: package-import@ubuntu.com-20120108201045-qbh9qngh29dziyot
Tags: 3.11.12-1
* New Upstream Release 
* Fix "Please rename the hplip packages to the printer-driver-
  convention" odyx patch - thks (Closes: #649991)
* Fix "debian/control uses hardcoded list of non-Linux architectures"
  Update Build-Depends: libudev-dev [linux-any] (Closes: #634488)
* Fix "hp-scan scans entire job and then reports inability to produce
  PDFs without reportlab" Added Depends: python-reportlab (Closes: #651240)
* Fix "hplip bug report" python handling correct (Closes: #609680)

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
dev_pat = re.compile(r"""/dev/.+""", re.IGNORECASE)
95
95
usb_pat = re.compile(r"""(\d+):(\d+)""", re.IGNORECASE)
96
96
 
 
97
### **********Lambda Function UniStar for checking type of arguments to constructor of class event*******************************
 
98
 
 
99
UniStr = lambda title: isinstance(title, str) and utils.xrstrip(title, '\x00')[:128] or utils.xrstrip(title, '\x00')[:128].encode('utf-8')  
 
100
 
 
101
 
97
102
#
98
103
# Event Wrapper Class for pipe IPC
99
104
#
102
107
    def __init__(self, device_uri, printer_name, event_code,
103
108
                 username=prop.username, job_id=0, title='',
104
109
                 timedate=0):
105
 
 
106
 
        self.device_uri = unicode(utils.xrstrip(device_uri, '\x00'))[:128].encode('utf-8')
107
 
        self.printer_name = unicode(utils.xrstrip(printer_name, '\x00'))[:128].encode('utf-8')
 
110
       # UniStr = lambda title: isinstance(title, str) and utils.xrstrip(title, '\x00')[:128] or utils.xrstrip(title, '\x00')[:128].encode('utf-8')
 
111
        self.device_uri = UniStr(device_uri)
 
112
        self.printer_name = UniStr(printer_name)
108
113
        self.event_code = int(event_code)
109
 
        self.username = unicode(utils.xrstrip(username, '\x00'))[:32].encode('utf-8')
 
114
        self.username = UniStr(username)
110
115
        self.job_id = int(job_id)
111
 
        self.title = unicode(utils.xrstrip(title, '\x00'))[:128].encode('utf-8')
 
116
        self.title = UniStr(title)
112
117
 
113
118
        if timedate:
114
119
            self.timedate = float(timedate)
2631
2636
 
2632
2637
        reply.seek(0)
2633
2638
        return reply.getvalue()
 
2639
 
 
2640
 
 
2641