Hi Aaron,
Here is an incremental diff which corrects how errors are handled since I had changed the sqlobject selectOne() call to storm's find().
{{{ === modified file 'lib/lp/registry/tests/test_productseries_vocabularies.py' --- lib/lp/registry/tests/test_productseries_vocabularies.py 2009-12-04 19:26:58 +0000 +++ lib/lp/registry/tests/test_productseries_vocabularies.py 2009-12-07 20:13:21 +0000 @@ -62,6 +62,11 @@ self.assertEqual(token, term.token) self.assertEqual(self.series, term.value)
+ def test_getTermByToken_LookupError(self): + self.assertRaises( + LookupError, + self.vocabulary.getTermByToken, 'does/notexist') +
def test_suite(): return TestLoader().loadTestsFromName(__name__)
=== modified file 'lib/lp/registry/vocabularies.py' --- lib/lp/registry/vocabularies.py 2009-12-04 20:40:30 +0000 +++ lib/lp/registry/vocabularies.py 2009-12-07 20:11:24 +0000 @@ -1015,9 +1015,9 @@ self._table, ProductSeries.product == Product.id, Product.name == productname, - ProductSeries.name == productseriesname) + ProductSeries.name == productseriesname).one() if result is not None: - return self.toTerm(result.one()) + return self.toTerm(result) raise LookupError(token)
def search(self, query):
}}}
« Back to merge proposal
Hi Aaron,
Here is an incremental diff which corrects how errors are handled since I had changed the sqlobject selectOne() call to storm's find().
{{{ registry/ tests/test_ productseries_ vocabularies. py' registry/ tests/test_ productseries_ vocabularies. py 2009-12-04 19:26:58 +0000 registry/ tests/test_ productseries_ vocabularies. py 2009-12-07 20:13:21 +0000
self. assertEqual( token, term.token)
self. assertEqual( self.series, term.value)
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -62,6 +62,11 @@
+ def test_getTermByT oken_LookupErro r(self) : .getTermByToken , 'does/notexist')
+ self.assertRaises(
+ LookupError,
+ self.vocabulary
+
def test_suite(): ).loadTestsFrom Name(__ name__)
return TestLoader(
=== modified file 'lib/lp/ registry/ vocabularies. py' registry/ vocabularies. py 2009-12-04 20:40:30 +0000 registry/ vocabularies. py 2009-12-07 20:11:24 +0000
self. _table,
ProductSe ries.product == Product.id,
Product. name == productname, me).one( ) result. one())
--- lib/lp/
+++ lib/lp/
@@ -1015,9 +1015,9 @@
- ProductSeries.name == productseriesname)
+ ProductSeries.name == productseriesna
if result is not None:
- return self.toTerm(
+ return self.toTerm(result)
raise LookupError(token)
def search(self, query):
}}}