# HG changeset patch # User Jeff Hammel # Date 1355962586 28800 # Node ID 7189c647270ac83efb920e8649a64ef88e1dd655 # Parent 935f8991ebb68304c267cdc4d28b658b3512511b make version choosing a bit more resilient diff -r 935f8991ebb6 -r 7189c647270a bzconsole/api.py --- a/bzconsole/api.py Mon Dec 17 12:12:14 2012 -0800 +++ b/bzconsole/api.py Wed Dec 19 16:16:26 2012 -0800 @@ -97,17 +97,17 @@ assert self.username and self.password, "Must be authenticated" # infer version if not given + versions = set(self._configuration['product'][product]['version']) if version is None: - versions = self._configuration['product'][product]['version'] if len(versions) == 1: - version = versions[0] + version = list(versions)[0] else: default_versions = ('unspecified', 'Trunk') for ver in default_versions: - version = ver - if version in self._configuration['product'][product]['version']: + if ver in versions: + version = ver break - assert version in self._configuration['product'][product]['version'], 'Version not found' + assert version in versions, 'Version not found (Available versions for product "%s": %s)' % (product, versions) # create the needed data structure request = dict(product=product, component=component, diff -r 935f8991ebb6 -r 7189c647270a setup.py --- a/setup.py Mon Dec 17 12:12:14 2012 -0800 +++ b/setup.py Wed Dec 19 16:16:26 2012 -0800 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.3.1' +version = '0.3.2' readme = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.txt')