Permalink
Browse files

Error better if printer not found, url decode account name when takin…

…g from uri
  • Loading branch information...
simoncadman committed Aug 22, 2012
1 parent 3888032 commit 8b8cc6edf419656e192ce82dd0e8cf662d80a54a
Showing with 4 additions and 2 deletions.
  1. +4 −2 printer.py
View
@@ -124,15 +124,17 @@ def getPrinterIDByURI(self, uri):
"""
printername, account = self.parseURI(uri)
# find requestor based on account
- requestor = self.findRequestorForAccount(account)
+ requestor = self.findRequestorForAccount(urllib.unquote(account))
+ if requestor == None:
+ return None, None
responseobj = requestor.doRequest('search?q=%s' % (printername))
printername = urllib.unquote(printername)
if 'printers' in responseobj and len(responseobj['printers']) > 0:
for printerdetail in responseobj['printers']:
if printername == printerdetail['name']:
return printerdetail['id'], requestor
else:
- return None
+ return None, None
def getPrinterDetails(self, printerid):
"""Gets details about printer from Google

0 comments on commit 8b8cc6e

Please sign in to comment.