changeset 4:9ee7b8236c36

now can list products and components
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 02 Nov 2010 11:02:29 -0700
parents 7830ec1f5dcd
children 43fb6fd8903d
files bzconsole/main.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bzconsole/main.py	Tue Nov 02 10:41:16 2010 -0700
+++ b/bzconsole/main.py	Tue Nov 02 11:02:29 2010 -0700
@@ -22,17 +22,19 @@
         self.server = server
 
     def products(self, classification=None):
-        """list bugzailla products"""
+        """list bugzilla products"""
         configuration = self._configuration()
         if classification:
-            raise NotImplementedError
+            products = [i for i in configuration['product'] if configuration['product'][i]['classification'] == 'Components']
+            return sorted(products)
         else:
             return sorted(configuration['product'].keys())
 
     def components(self, product):
         """list bugzilla components for a particular product"""
         configuration = self._configuration()
-        raise NotImplementedError
+        assert product in configuration['product'], 'Product %s not found' % product
+        return sorted(configuration['product'][product]['component'].keys())
 
     def _configuration(self):
         if not hasattr(self, '__configuration'):