Rev 5616: (jelmer) Lazy load a couple of modules in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jan 17 02:10:38 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5616 [merge]
revision-id: pqm at pqm.ubuntu.com-20110117021036-1wijz0xbaiw6cb8d
parent: pqm at pqm.ubuntu.com-20110115201943-es5zdz223vtgweyf
parent: jelmer at samba.org-20110117002303-rm402s7uy0lpdbcx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-01-17 02:10:36 +0000
message:
  (jelmer) Lazy load a couple of modules in
   bzrlib.plugins.launchpad.lp_propose. (Jelmer Vernooij)
modified:
  bzrlib/plugins/launchpad/lp_propose.py lp_submit.py-20100120065117-penrmqruf596pui6-1
=== modified file 'bzrlib/plugins/launchpad/lp_propose.py'
--- a/bzrlib/plugins/launchpad/lp_propose.py	2010-12-02 10:41:05 +0000
+++ b/bzrlib/plugins/launchpad/lp_propose.py	2011-01-17 00:23:03 +0000
@@ -14,21 +14,22 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-
-import webbrowser
-
 from bzrlib import (
     errors,
     hooks,
+    )
+from bzrlib.lazy_import import lazy_import
+lazy_import(globals(), """
+import webbrowser
+
+from bzrlib import (
     msgeditor,
 )
 from bzrlib.plugins.launchpad import (
     lp_api,
     lp_registration,
 )
-from bzrlib.plugins.launchpad.lp_api import canonical_url
-
-from lazr.restfulclient import errors as restful_errors
+""")
 
 
 class ProposeMergeHooks(hooks.Hooks):
@@ -153,7 +154,7 @@
             if mp.target_branch.self_link == self.target_branch.lp.self_link:
                 raise errors.BzrCommandError(
                     'There is already a branch merge proposal: %s' %
-                    canonical_url(mp))
+                    lp_api.canonical_url(mp))
 
     def _get_prerequisite_branch(self):
         hooks = self.hooks['get_prerequisite']
@@ -174,6 +175,7 @@
         :param **kwargs: **kwargs for the call.
         :return: The result of calling call(*args, *kwargs).
         """
+        from lazr.restfulclient import errors as restful_errors
         try:
             return call(*args, **kwargs)
         except restful_errors.HTTPError, e:
@@ -208,7 +210,7 @@
             review_types=review_types)
         if self.approve:
             self.call_webservice(mp.setStatus, status='Approved')
-        webbrowser.open(canonical_url(mp))
+        webbrowser.open(lp_api.canonical_url(mp))
 
 
 def modified_files(old_tree, new_tree):




More information about the bazaar-commits mailing list