~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to lp_registration.py

  • Committer: Martin Pool
  • Date: 2006-03-22 22:04:44 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-20060322220444-51dee38a77ce34cd
Allow xmlrpc service url to be overridden by $BZR_LP_XMLRPC_URL

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
 
18
18
from getpass import getpass
 
19
import os
19
20
from urlparse import urlsplit, urlunsplit
20
21
from urllib import unquote, quote
21
22
import xmlrpclib
34
35
 
35
36
    # NB: this should always end in a slash to avoid xmlrpclib appending
36
37
    # '/RPC2'
37
 
    # DEFAULT_SERVICE_URL = 'http://xmlrpc.launchpad.net/bazaar/'
38
 
    DEFAULT_SERVICE_URL = 'http://10.65.252.255:8081/'
 
38
    DEFAULT_SERVICE_URL = 'http://xmlrpc.launchpad.net/bazaar/'
39
39
 
40
40
    # None means to use the xmlrpc default, which is almost always what you
41
41
    # want.  But it might be useful for testing.
58
58
        self.author_email = author_email
59
59
        self.product_name = product_name
60
60
        # XXX: these should perhaps be in the registration method
61
 
        self.service_url = self.DEFAULT_SERVICE_URL
62
61
        self.registrant_email = 'testuser@launchpad.net'
63
62
        self.registrant_password = 'testpassword'
64
63
 
74
73
                self.product_name,
75
74
               )
76
75
 
 
76
    def _get_service_url(self):
 
77
        """Return the http or https url for the xmlrpc server.
 
78
 
 
79
        This does not include the username/password credentials.
 
80
        """
 
81
        key = 'BZR_LP_XMLRPC_URL'
 
82
        if key in os.environ:
 
83
            return os.environ[key]
 
84
        else:
 
85
            return self.DEFAULT_SERVICE_URL
 
86
 
 
87
    service_url = property(_get_service_url)
 
88
 
77
89
    def submit(self, transport=None):
78
90
        """Submit registration request to the server.
79
91