Rev 5: Support 'lp_password' as a config entry. in http://bzr.arbash-meinel.com/plugins/register

John Arbash Meinel john at arbash-meinel.com
Fri Mar 23 16:48:39 GMT 2007


At http://bzr.arbash-meinel.com/plugins/register

------------------------------------------------------------
revno: 5
revision-id: john at arbash-meinel.com-20070323164825-1g6w0pzhm8dj15wi
parent: john at arbash-meinel.com-20070323163205-0xk06kc7txaol1ww
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: register
timestamp: Fri 2007-03-23 11:48:25 -0500
message:
  Support 'lp_password' as a config entry.
  Now you don't have to type your LP password for every 'bzr reg'
modified:
  __init__.py                    __init__.py-20060816173937-anpuzdybrrnsbg5x-1
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-03-23 16:32:05 +0000
+++ b/__init__.py	2007-03-23 16:48:25 +0000
@@ -109,6 +109,14 @@
 
         if dry_run:
             print 'executing command: %s' % (cmd,)
+        else:
+            # This is a bit of a hack, because we can't pass in the
+            # password directly. So we update the internal object to use the
+            # password rather than prompting
+            lp_password = get_lp_password(branch, branch_config)
+            if lp_password is not None:
+                from bzrlib.plugins.launchpad import lp_registration
+                lp_registration.LaunchpadService.registrant_password = lp_password
 
         return commands.run_bzr_catch_errors(cmd)
 
@@ -171,6 +179,11 @@
     return product
 
 
+def get_lp_password(a_branch, branch_config):
+    """Determine the LP password for this user."""
+    return branch_config.get_user_option('lp_password')
+
+
 def check_public_exists(location):
     """Check that the predicted public location really is a branch"""
     try:



More information about the bazaar-commits mailing list