Merge lp:~mardy/account-plugins/python3 into lp:account-plugins

Proposed by Alberto Mardegan
Status: Merged
Approved by: David King
Approved revision: 62
Merged at revision: 62
Proposed branch: lp:~mardy/account-plugins/python3
Merge into: lp:account-plugins
Diff against target: 117 lines (+16/-16)
1 file modified
tools/account-console (+16/-16)
To merge this branch: bzr merge lp:~mardy/account-plugins/python3
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Approve
David King (community) Approve
Review via email: mp+121765@code.launchpad.net

Description of the change

Port to python3

Patch by Ken Vandine.

To post a comment you must log in.
Revision history for this message
David King (amigadave) wrote :

Works fine.

review: Approve
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/account-console'
2--- tools/account-console 2012-07-23 06:14:53 +0000
3+++ tools/account-console 2012-08-29 08:02:22 +0000
4@@ -1,9 +1,9 @@
5-#! /usr/bin/env python
6+#! /usr/bin/python3
7
8 import argparse
9-import glib
10 import sys
11
12+from gi.repository import GLib
13 from gi.repository import GObject
14 from gi.repository import Accounts
15 from gi.repository import Signon
16@@ -18,14 +18,14 @@
17 def list_accounts(self, args):
18 accounts = self.manager.list()
19 if not accounts:
20- print 'No accounts'
21+ print('No accounts')
22 main_loop.quit()
23 return
24
25 for account_id in accounts:
26 account = self.manager.get_account(account_id)
27 enabledness = 'enabled' if account.get_enabled() else 'disabled'
28- print 'account: id %s, %s, provider: %s' % (account_id, enabledness, account.get_provider_name())
29+ print('account: id %s, %s, provider: %s' % (account_id, enabledness, account.get_provider_name()))
30 main_loop.quit()
31
32
33@@ -37,8 +37,8 @@
34 sys.exit(1)
35
36 enabledness = 'enabled' if account.get_enabled() else 'disabled'
37- print 'account: id %s, %s, provider: %s' % (account.id, enabledness, account.get_provider_name())
38- print ' Global settings:'
39+ print('account: id %s, %s, provider: %s' % (account.id, enabledness, account.get_provider_name()))
40+ print(' Global settings:')
41 i = account.get_settings_iter(None)
42 self.enumerate_settings(i)
43
44@@ -46,7 +46,7 @@
45 services = account.list_services()
46 for s in services:
47 service = Accounts.AccountService.new(account, s)
48- print ' Settings for %s' % (s.get_name(),)
49+ print(' Settings for %s' % (s.get_name(),))
50 i = service.get_settings_iter(None)
51 self.enumerate_settings(i)
52 main_loop.quit()
53@@ -124,7 +124,7 @@
54
55
56 def on_credentials_stored(self, identity, id, error, account):
57- print 'On credentials stored', id
58+ print('On credentials stored', id)
59 account.set_value(self.args.signon_id_field, int(id))
60 account.store(self.on_account_stored, None)
61
62@@ -186,7 +186,7 @@
63 else:
64 self.session = Signon.AuthSession.new(0, method)
65
66- print session_data
67+ print(session_data)
68 self.session.process(session_data, mechanism,
69 self.login_process_cb, None)
70
71@@ -216,13 +216,13 @@
72 print >> sys.stderr, 'Got authentication error:', error.message
73 sys.exit(1)
74
75- print 'Got reply: ', reply
76+ print('Got reply: ', reply)
77 main_loop.quit()
78
79
80 def on_account_stored_deleted(self, account, error, userdata):
81 if not error:
82- print 'OK'
83+ print('OK')
84 else:
85 print >> sys.stderr, 'Error occurred: ', error.message
86 main_loop.quit()
87@@ -230,9 +230,9 @@
88 def on_account_stored(self, account, error, userdata):
89 if not error:
90 if 'print_id' in self.args and self.args.print_id:
91- print '%s' % (account.id)
92+ print('%s' % (account.id))
93 else:
94- print 'OK %s' % (account.id)
95+ print('OK %s' % (account.id))
96 else:
97 print >> sys.stderr, 'Error occurred: ', error.message
98 main_loop.quit()
99@@ -246,7 +246,7 @@
100
101 settings.sort()
102 for (key, value) in settings:
103- print ' %s: %s (%s)' % (key, value, type(value))
104+ print(' %s: %s (%s)' % (key, value, type(value)))
105
106 def parse_setting(self, setting):
107 (name, value_str) = setting.split('=')
108@@ -357,8 +357,8 @@
109
110 args = parser.parse_args()
111
112-main_loop = glib.MainLoop()
113-glib.idle_add(args.func, args)
114+main_loop = GLib.MainLoop()
115+GLib.idle_add(args.func, args)
116
117 main_loop.run()
118

Subscribers

People subscribed via source and target branches