~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to lp_registration.py

  • Committer: Martin Pool
  • Date: 2006-03-23 16:18:02 UTC
  • mto: (1668.1.8 bzr-0.8.mbp)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: mbp@sourcefrog.net-20060323161802-0c40176f8582335c
Refactor BaseRequest.submit so details of submission are in the LaunchpadService

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
                    self.registrant_email
69
69
            self.registrant_password = getpass(prompt)
70
70
 
 
71
    def send_request(self, method_name, method_params):
 
72
        proxy = self.get_proxy()
 
73
        assert method_name
 
74
        method = getattr(proxy, method_name)
 
75
        result = method(*method_params)
 
76
        return result
 
77
 
 
78
 
71
79
class BaseRequest(object):
72
80
    """Base request for talking to a XMLRPC server."""
73
81
 
79
87
        raise NotImplementedError(self._request_params)
80
88
 
81
89
    def submit(self, service):
82
 
        """Submit registration request to the server.
83
 
 
84
 
        The particular server to use is set in self.service_url; this 
85
 
        should only need to be changed for testing.
86
 
 
87
 
        :param transport: If non-null, use a special xmlrpclib.Transport
88
 
            to send the request.  This has no connection to bzrlib
89
 
            Transports.
 
90
        """Submit request to Launchpad XMLRPC server.
 
91
 
 
92
        :param service: LaunchpadService indicating where to send
 
93
            the request and the authentication credentials.
90
94
        """
91
 
        proxy = service.get_proxy()
92
 
        assert self._methodname
93
 
        method = getattr(proxy, self._methodname)
94
 
        result = method(*self._request_params())
95
 
        return result
 
95
        return service.send_request(self._methodname, self._request_params())
96
96
 
97
97
 
98
98
class BranchRegistrationRequest(BaseRequest):