~ubuntu-branches/ubuntu/wily/system-config-printer/wily

« back to all changes in this revision

Viewing changes to authconn.py

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2014-08-05 23:59:59 UTC
  • mfrom: (256.1.1 utopic-proposed)
  • Revision ID: package-import@ubuntu.com-20140805235959-v1yzis5mo1nkxo2m
Tags: 1.5.0+20140805-0ubuntu2
debian/control: Build-depend on Python 3 (python3-all-dev).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
 
1
#!/usr/bin/python3
2
2
 
3
3
## Copyright (C) 2007, 2008, 2009, 2010, 2011, 2013, 2014 Red Hat, Inc.
4
4
## Author: Tim Waugh <twaugh@redhat.com>
28
28
from errordialogs import *
29
29
from debug import *
30
30
import gettext
31
 
gettext.install(domain=config.PACKAGE, localedir=config.localedir, unicode=True)
 
31
gettext.install(domain=config.PACKAGE, localedir=config.localedir)
32
32
N_ = lambda x: x
33
33
 
34
34
cups.require("1.9.60")
102
102
            self.field_entry[i].set_text (auth_info[i])
103
103
 
104
104
    def get_auth_info (self):
105
 
        return map (lambda x: x.get_text (), self.field_entry)
 
105
        return [x.get_text () for x in self.field_entry]
106
106
 
107
107
    def get_remember_password (self):
108
108
        try:
250
250
                break
251
251
            except cups.IPPError as e:
252
252
                (e, m) = e.args
253
 
                if isinstance(m, bytes):
254
 
                    m = m.decode('utf-8', 'replace')
255
253
                if self._use_pk and m == 'pkcancel':
256
254
                    raise cups.IPPError (0, _("Operation canceled"))
257
255
 
260
258
                                         e == cups.IPP_AUTHENTICATION_CANCELED):
261
259
                    self._failed (e == cups.IPP_FORBIDDEN)
262
260
                elif not self._cancel and e == cups.IPP_SERVICE_UNAVAILABLE:
 
261
                    debugprint ("Got IPP_SERVICE_UNAVAILABLE")
 
262
                    debugprint (m)
263
263
                    if self._lock:
264
264
                        self._gui_event.clear ()
265
265
                        GLib.timeout_add (1, self._ask_retry_server_error, m)
518
518
    c = TimedOperation (Connection, args=(None,)).run ()
519
519
    debugprint ("Connected")
520
520
    c._set_lock (True)
521
 
    print TimedOperation (c.getFile,
 
521
    print(TimedOperation (c.getFile,
522
522
                          args=('/admin/conf/cupsd.conf',
523
 
                                '/dev/stdout')).run ()
 
523
                                '/dev/stdout')).run ())