~inspirated/arsenal/fix-debian

« back to all changes in this revision

Viewing changes to arsenal/application.py

  • Committer: Kamran Riaz Khan
  • Date: 2010-08-15 14:10:48 UTC
  • Revision ID: krkhan@inspirated.com-20100815141048-bsxnibv99dtfu512
Fix API url detection based on launchpadlib version

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
from ConfigParser import ConfigParser
14
14
from StringIO import StringIO
 
15
from distutils.version import StrictVersion
15
16
from fnmatch import fnmatch
16
17
from getpass import getpass
17
18
from locale import getpreferredencoding
23
24
import pycurl
24
25
import gnomekeyring as gkeyring
25
26
 
 
27
import launchpadlib
 
28
 
26
29
from arsenal.bugzilla_adapter import (BugzillaAdapter, BugzillaLoginError)
27
30
from arsenal.info import (BugzillaInfo, LaunchpadInfo)
28
31
 
95
98
        matches = pattern.search(self.launchpad.parsedurl.netloc).groups()
96
99
        self.launchpad.api = (self.launchpad.parsedurl.scheme + '://api.' +
97
100
                              matches[0] + '.' + matches[1])
98
 
        self.launchpad.api = urljoin(self.launchpad.api, 'beta/')
 
101
        if StrictVersion(launchpadlib.__version__) < StrictVersion('1.5.8'):
 
102
            self.launchpad.api = urljoin(self.launchpad.api, 'beta/')
99
103
 
100
104
    def sub_url_query(self, url):
101
105
        pattern = re.compile(r'^(.*\/)([^\/]*?)$')