Skip to content

Commit

Permalink
permit unicode user IDs, no empty opts, debug log
Browse files Browse the repository at this point in the history
* produce debug-level log with exception detail if printing fails
* exclude options whose values are the string 'None'
* ensure ownerId is passed to CUPS as escaped-unicode string.
  • Loading branch information
4gra authored Apr 26, 2018
1 parent 108b9f0 commit 761a30a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cloudprint/cloudprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ def process_job(cups_connection, cpp, printer, job):
if 'request' in options:
del options['request']

options = dict((str(k), str(v)) for k, v in list(options.items()))
options['job-originating-user-name'] = job['ownerId']
options = dict((str(k), str(v)) for k, v in list(options.items()) if v != 'None')
options['job-originating-user-name'] = job['ownerId'].encode('unicode_escape')

# Cap the title length to 255, or cups will complain about invalid
# job-name
Expand All @@ -425,7 +425,8 @@ def process_job(cups_connection, cpp, printer, job):
cpp.finish_job(job['id'])
num_retries = 0

except Exception:
except Exception, e:
LOGGER.debug(unicode_escape('ERROR detail: ' + e))
if num_retries >= RETRIES:
num_retries = 0
cpp.fail_job(job['id'])
Expand Down

1 comment on commit 761a30a

@4gra
Copy link
Owner Author

@4gra 4gra commented on 761a30a Apr 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see also armooo#137

Please sign in to comment.