changeset 51:7189c647270a

make version choosing a bit more resilient
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 19 Dec 2012 16:16:26 -0800
parents 935f8991ebb6
children f961f2002d4e
files bzconsole/api.py setup.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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,
--- 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')