# HG changeset patch # User Jeff Hammel # Date 1291937100 28800 # Node ID e04729acf5be9ef6794f41239595d5aaa21487de # Parent c819c8388ad13532982e3fbe07ed5b49ead37b64 allow bzconsole to implicitly get the product from the component for new bugs, if the component is unique diff -r c819c8388ad1 -r e04729acf5be bzconsole/api.py --- a/bzconsole/api.py Thu Dec 09 15:16:32 2010 -0800 +++ b/bzconsole/api.py Thu Dec 09 15:25:00 2010 -0800 @@ -68,12 +68,18 @@ del retval[d] return retval, dupe - def new(self, product, component, title, version=None, description=None): + def new(self, component, title, product=None, + version=None, description=None): """file a new bug. username and password must be set""" # sanity check - assert product in self.products(), "Product not found" - assert component in self.components(product), "Component not found" + if product: + assert product in self.products(), "Product not found" + assert component in self.components(product), "Component not found" + else: + unique, dupe = self._unique_components() + assert component in unique, 'Unique component not found: %s' % component + product = unique[component] assert title, 'Must provide a bug summary' assert self.username and self.password, "Must be authenticated" @@ -81,7 +87,7 @@ if version is None: version = 'unspecified' assert version in self._configuration['product'][product]['version'], 'Version not found' - + # get the bug description if not description: description = tmpbuffer()