Merge lp:~ossug-hychen/laika/getbzrlogin into lp:laika

Proposed by Hsin-Yi, Chen (hychen) on 2011-11-25
Status: Merged
Merged at revision: 18
Proposed branch: lp:~ossug-hychen/laika/getbzrlogin
Merge into: lp:laika
Diff against target: 30 lines (+10/-2)
1 file modified
laika (+10/-2)
To merge this branch: bzr merge lp:~ossug-hychen/laika/getbzrlogin
Reviewer Review Type Date Requested Status
Alex Chiang 2011-11-25 Approve on 2011-12-06
Review via email: mp+83372@code.launchpad.net

Description of the change

the os username may not launchpad id , and we can took the launchpad id from bzr

To post a comment you must log in.
Alex Chiang (achiang) wrote :

Looks good, thanks Tyson!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'laika'
2--- laika 2011-08-08 17:25:11 +0000
3+++ laika 2011-11-25 08:11:24 +0000
4@@ -218,8 +218,16 @@
5 laika_config = ConfigParser.ConfigParser()
6 laika_config.read(os.path.expanduser("~/.laikarc"))
7
8+ def get_bzrlplogin():
9+ path = os.path.expanduser('~/.bazaar/bazaar.conf')
10+ if not os.path.exists(path):
11+ return None
12+ else:
13+ cfg = ConfigParser.ConfigParser()
14+ cfg.read(os.path.expanduser('~/.bazaar/bazaar.conf'))
15+ return cfg.get('DEFAULT', 'launchpad_username')
16 def default_user():
17- return os.getenv("USER")
18+ return get_bzrlplogin() or os.getenv("USER")
19 def default_window():
20 return 8
21 def default_bugpattern():
22@@ -230,7 +238,7 @@
23 for opt in opts:
24 try:
25 config[opt] = laika_config.get(FORMAT, opt)
26- except:
27+ except:
28 config[opt] = locals()["default_%s" % opt]()
29
30 return config

Subscribers

People subscribed via source and target branches