Skip to content

Fix unicode / option handling blockers #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Google's linux connector, it does not require chrome to be installed on the serv
Requires
---------------------------------------------------
- python 2.6 or 2.7
- pycups (can be tricky on OS X) wich depends on libcups2-dev
- pycups (can be tricky on OS X) which depends on libcups2-dev

Usage
---------------------------------------------------
Expand Down
17 changes: 17 additions & 0 deletions cloudprint.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=Google Cloud Print Daemon
Requires=cups.service
After=cups.service
Documentation=https://github.com/4gra/cloudprint

[Service]
User=printer
ExecStart=/usr/local/bin/cloudprint
Restart=always
RestartSec=300
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=cloudprint

[Install]
WantedBy=multi-user.target
11 changes: 8 additions & 3 deletions cloudprint/cloudprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,12 @@ 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 +429,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: %s' % e))
if num_retries >= RETRIES:
num_retries = 0
cpp.fail_job(job['id'])
Expand Down