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
=== modified file 'tools/account-console'
--- tools/account-console 2012-07-23 06:14:53 +0000
+++ tools/account-console 2012-08-29 08:02:22 +0000
@@ -1,9 +1,9 @@
1#! /usr/bin/env python1#! /usr/bin/python3
22
3import argparse3import argparse
4import glib
5import sys4import sys
65
6from gi.repository import GLib
7from gi.repository import GObject7from gi.repository import GObject
8from gi.repository import Accounts8from gi.repository import Accounts
9from gi.repository import Signon9from gi.repository import Signon
@@ -18,14 +18,14 @@
18 def list_accounts(self, args):18 def list_accounts(self, args):
19 accounts = self.manager.list()19 accounts = self.manager.list()
20 if not accounts:20 if not accounts:
21 print 'No accounts'21 print('No accounts')
22 main_loop.quit()22 main_loop.quit()
23 return23 return
2424
25 for account_id in accounts:25 for account_id in accounts:
26 account = self.manager.get_account(account_id)26 account = self.manager.get_account(account_id)
27 enabledness = 'enabled' if account.get_enabled() else 'disabled'27 enabledness = 'enabled' if account.get_enabled() else 'disabled'
28 print 'account: id %s, %s, provider: %s' % (account_id, enabledness, account.get_provider_name())28 print('account: id %s, %s, provider: %s' % (account_id, enabledness, account.get_provider_name()))
29 main_loop.quit()29 main_loop.quit()
3030
3131
@@ -37,8 +37,8 @@
37 sys.exit(1)37 sys.exit(1)
3838
39 enabledness = 'enabled' if account.get_enabled() else 'disabled'39 enabledness = 'enabled' if account.get_enabled() else 'disabled'
40 print 'account: id %s, %s, provider: %s' % (account.id, enabledness, account.get_provider_name())40 print('account: id %s, %s, provider: %s' % (account.id, enabledness, account.get_provider_name()))
41 print ' Global settings:'41 print(' Global settings:')
42 i = account.get_settings_iter(None)42 i = account.get_settings_iter(None)
43 self.enumerate_settings(i)43 self.enumerate_settings(i)
4444
@@ -46,7 +46,7 @@
46 services = account.list_services()46 services = account.list_services()
47 for s in services:47 for s in services:
48 service = Accounts.AccountService.new(account, s)48 service = Accounts.AccountService.new(account, s)
49 print ' Settings for %s' % (s.get_name(),)49 print(' Settings for %s' % (s.get_name(),))
50 i = service.get_settings_iter(None)50 i = service.get_settings_iter(None)
51 self.enumerate_settings(i)51 self.enumerate_settings(i)
52 main_loop.quit()52 main_loop.quit()
@@ -124,7 +124,7 @@
124124
125125
126 def on_credentials_stored(self, identity, id, error, account):126 def on_credentials_stored(self, identity, id, error, account):
127 print 'On credentials stored', id127 print('On credentials stored', id)
128 account.set_value(self.args.signon_id_field, int(id))128 account.set_value(self.args.signon_id_field, int(id))
129 account.store(self.on_account_stored, None)129 account.store(self.on_account_stored, None)
130130
@@ -186,7 +186,7 @@
186 else:186 else:
187 self.session = Signon.AuthSession.new(0, method)187 self.session = Signon.AuthSession.new(0, method)
188188
189 print session_data189 print(session_data)
190 self.session.process(session_data, mechanism,190 self.session.process(session_data, mechanism,
191 self.login_process_cb, None)191 self.login_process_cb, None)
192192
@@ -216,13 +216,13 @@
216 print >> sys.stderr, 'Got authentication error:', error.message216 print >> sys.stderr, 'Got authentication error:', error.message
217 sys.exit(1)217 sys.exit(1)
218218
219 print 'Got reply: ', reply219 print('Got reply: ', reply)
220 main_loop.quit()220 main_loop.quit()
221221
222222
223 def on_account_stored_deleted(self, account, error, userdata):223 def on_account_stored_deleted(self, account, error, userdata):
224 if not error:224 if not error:
225 print 'OK'225 print('OK')
226 else:226 else:
227 print >> sys.stderr, 'Error occurred: ', error.message227 print >> sys.stderr, 'Error occurred: ', error.message
228 main_loop.quit()228 main_loop.quit()
@@ -230,9 +230,9 @@
230 def on_account_stored(self, account, error, userdata):230 def on_account_stored(self, account, error, userdata):
231 if not error:231 if not error:
232 if 'print_id' in self.args and self.args.print_id:232 if 'print_id' in self.args and self.args.print_id:
233 print '%s' % (account.id)233 print('%s' % (account.id))
234 else:234 else:
235 print 'OK %s' % (account.id)235 print('OK %s' % (account.id))
236 else:236 else:
237 print >> sys.stderr, 'Error occurred: ', error.message237 print >> sys.stderr, 'Error occurred: ', error.message
238 main_loop.quit()238 main_loop.quit()
@@ -246,7 +246,7 @@
246246
247 settings.sort()247 settings.sort()
248 for (key, value) in settings:248 for (key, value) in settings:
249 print ' %s: %s (%s)' % (key, value, type(value))249 print(' %s: %s (%s)' % (key, value, type(value)))
250250
251 def parse_setting(self, setting):251 def parse_setting(self, setting):
252 (name, value_str) = setting.split('=')252 (name, value_str) = setting.split('=')
@@ -357,8 +357,8 @@
357357
358args = parser.parse_args()358args = parser.parse_args()
359359
360main_loop = glib.MainLoop()360main_loop = GLib.MainLoop()
361glib.idle_add(args.func, args)361GLib.idle_add(args.func, args)
362362
363main_loop.run()363main_loop.run()
364364

Subscribers

People subscribed via source and target branches