Permalink
Browse files

Show better error if renewing OAUTH2 token fails

  • Loading branch information...
simoncadman committed Jan 26, 2014
1 parent 7cd40ac commit 0ec12723c59b75cb0aaa16678ab0395d039f97de
Showing with 52 additions and 10 deletions.
  1. +6 −1 auth.py
  2. +1 −1 backend.py
  3. +1 −1 deleteaccount.py
  4. +1 −1 dynamicppd.py
  5. +1 −1 listcloudprinters.py
  6. +1 −1 listdrivefiles.py
  7. +1 −1 reportissues.py
  8. +37 −0 setup.py
  9. +1 −1 setupcloudprint.py
  10. +1 −1 submitjob.py
  11. +1 −1 upgrade.py
View
@@ -142,7 +142,12 @@ def SetupAuth(interactive=False, permissions=['https://www.googleapis.com/auth/c
# renew if expired
requestor = cloudprintrequestor()
if credentials.access_token_expired: # pragma: no cover
- credentials.refresh(requestor)
+ from oauth2client.client import AccessTokenRefreshError
+ try:
+ credentials.refresh(requestor)
+ except AccessTokenRefreshError as e:
+ sys.stderr.write("Failed to renew token (error: "+ str(e) +"), if you have revoked access to CUPS Cloud Print in your Google Account, please delete /etc/cloudprint.conf and re-run /usr/share/cloudprint-cups/setupcloudprint.py")
+ sys.exit(1)
requestor = credentials.authorize(requestor)
requestor.setAccount(userid)
View
@@ -20,7 +20,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print CUPS Backend Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Delete Account Script Version " + CCPVersion
sys.exit(0)
View
@@ -19,7 +19,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Dynamic PPD Generator Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Printer Lister Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Printer Drive Lister Version " + CCPVersion
sys.exit(0)
View
@@ -19,7 +19,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Issue Reporting Script Version " + CCPVersion
sys.exit(0)
View
@@ -0,0 +1,37 @@
+import os
+
+from setuptools import setup
+
+def read(*paths):
+ """Build a file path from *paths* and return the contents."""
+ with open(os.path.join(*paths), 'r') as f:
+ return f.read()
+
+setup(
+ name='pem',
+ version='0.1.0',
+ description='Parse and split PEM files painlessly.',
+ long_description=(read('README.rst') + '\n\n' +
+ read('HISTORY.rst') + '\n\n' +
+ read('AUTHORS.rst')),
+ url='http://github.com/hynek/pem/',
+ license='GPL-3',
+ author='Hynek Schlawack',
+ author_email='hs@ox.cx',
+ py_modules=['pem'],
+ include_package_data=True,
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'Natural Language :: English',
+ 'License :: OSI Approved :: GPL v3',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Setup Script Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20140112 212220"
+ CCPVersion = "20140126 002826"
print "CUPS Cloud Print Submit Job Version " + CCPVersion
sys.exit(0)
View
@@ -37,7 +37,7 @@
sys.stderr.write("If you are upgrading from version 20131013 or earlier you should be aware that the scripts have moved from /usr/lib/cloudprint-cups to /usr/share/cloudprint-cups\n")
# line below is replaced on commit
-CCPVersion = "20140112 212220"
+CCPVersion = "20140126 002826"
if len(sys.argv) == 2 and sys.argv[1] == 'version':
print "CUPS Cloud Print Upgrade Script Version " + CCPVersion

0 comments on commit 0ec1272

Please sign in to comment.