~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
            # TODO: if there's no registrant email perhaps we should
105
105
            # just connect anonymously?
106
106
            scheme, hostinfo, path = urlsplit(self.service_url)[:3]
107
 
            assert '@' not in hostinfo
108
 
            assert self.registrant_email is not None
109
 
            assert self.registrant_password is not None
 
107
            if '@' in hostinfo:
 
108
                raise AssertionError(hostinfo)
 
109
            if self.registrant_email is None:
 
110
                raise AssertionError()
 
111
            if self.registrant_password is None:
 
112
                raise AssertionError()
110
113
            # TODO: perhaps fully quote the password to make it very slightly
111
114
            # obscured
112
115
            # TODO: can we perhaps add extra Authorization headers
139
142
 
140
143
    def send_request(self, method_name, method_params, authenticated):
141
144
        proxy = self.get_proxy(authenticated)
142
 
        assert method_name
143
145
        method = getattr(proxy, method_name)
144
146
        try:
145
147
            result = method(*method_params)
240
242
    _methodname = 'link_branch_to_bug'
241
243
 
242
244
    def __init__(self, branch_url, bug_id):
243
 
        assert branch_url
244
245
        self.bug_id = bug_id
245
246
        self.branch_url = branch_url
246
247