~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/lp_propose.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-17 02:10:36 UTC
  • mfrom: (5615.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20110117021036-1wijz0xbaiw6cb8d
(jelmer) Lazy load a couple of modules in
 bzrlib.plugins.launchpad.lp_propose. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
 
18
 
import webbrowser
19
 
 
20
17
from bzrlib import (
21
18
    errors,
22
19
    hooks,
 
20
    )
 
21
from bzrlib.lazy_import import lazy_import
 
22
lazy_import(globals(), """
 
23
import webbrowser
 
24
 
 
25
from bzrlib import (
23
26
    msgeditor,
24
27
)
25
28
from bzrlib.plugins.launchpad import (
26
29
    lp_api,
27
30
    lp_registration,
28
31
)
29
 
from bzrlib.plugins.launchpad.lp_api import canonical_url
30
 
 
31
 
from lazr.restfulclient import errors as restful_errors
 
32
""")
32
33
 
33
34
 
34
35
class ProposeMergeHooks(hooks.Hooks):
153
154
            if mp.target_branch.self_link == self.target_branch.lp.self_link:
154
155
                raise errors.BzrCommandError(
155
156
                    'There is already a branch merge proposal: %s' %
156
 
                    canonical_url(mp))
 
157
                    lp_api.canonical_url(mp))
157
158
 
158
159
    def _get_prerequisite_branch(self):
159
160
        hooks = self.hooks['get_prerequisite']
174
175
        :param **kwargs: **kwargs for the call.
175
176
        :return: The result of calling call(*args, *kwargs).
176
177
        """
 
178
        from lazr.restfulclient import errors as restful_errors
177
179
        try:
178
180
            return call(*args, **kwargs)
179
181
        except restful_errors.HTTPError, e:
208
210
            review_types=review_types)
209
211
        if self.approve:
210
212
            self.call_webservice(mp.setStatus, status='Approved')
211
 
        webbrowser.open(canonical_url(mp))
 
213
        webbrowser.open(lp_api.canonical_url(mp))
212
214
 
213
215
 
214
216
def modified_files(old_tree, new_tree):