Merge lp:~mardy/account-plugins/fix-tool-identity into lp:account-plugins

Proposed by Alberto Mardegan
Status: Merged
Approved by: David King
Approved revision: 79
Merged at revision: 79
Proposed branch: lp:~mardy/account-plugins/fix-tool-identity
Merge into: lp:account-plugins
Diff against target: 40 lines (+7/-8)
1 file modified
tools/account-console (+7/-8)
To merge this branch: bzr merge lp:~mardy/account-plugins/fix-tool-identity
Reviewer Review Type Date Requested Status
David King (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+135864@code.launchpad.net

Description of the change

account-console: don't fail on missing Identity

Also, don't let the program crash when no arguments are given, and remove
unnecessary debug output.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
David King (amigadave) :
review: Approve

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-08-29 07:54:32 +0000
3+++ tools/account-console 2012-11-23 10:51:34 +0000
4@@ -92,7 +92,7 @@
5 value = GObject.Value()
6 value.init(GObject.TYPE_UINT)
7 signon_id = account.get_value(args.signon_id_field, value)
8- if signon_id != Accounts.SettingSource.NONE:
9+ if signon_id != Accounts.SettingSource.NONE and value.get_uint() != 0:
10 self.identity = Signon.Identity.new_from_db(value.get_uint())
11 self.identity.query_info(self.on_info_ready, None)
12 else:
13@@ -124,12 +124,10 @@
14
15
16 def on_credentials_stored(self, identity, id, error, account):
17- print('On credentials stored', id)
18 account.set_value(self.args.signon_id_field, int(id))
19 account.store(self.on_account_stored, None)
20
21
22-
23 def delete_account(self, args):
24 self.args = args
25 account = self.manager.get_account(args.account)
26@@ -356,9 +354,10 @@
27 subparser.set_defaults(func=app.login_account)
28
29 args = parser.parse_args()
30-
31-main_loop = GLib.MainLoop()
32-GLib.idle_add(args.func, args)
33-
34-main_loop.run()
35+if 'func' in args:
36+ main_loop = GLib.MainLoop()
37+ GLib.idle_add(args.func, args)
38+ main_loop.run()
39+else:
40+ parser.print_help()
41

Subscribers

People subscribed via source and target branches