Permalink
Browse files

Make a better default choice for warehouse.db.mapping

  • Loading branch information...
1 parent 11b5843 commit b63e16f469568838680016061448632d9d4b14e2 @dstufft committed Feb 28, 2014
Showing with 1 addition and 3 deletions.
  1. +1 −1 warehouse/db.py
  2. +0 −2 warehouse/packaging/models.py
View
@@ -48,7 +48,7 @@ def inner(model, *args, **kwargs):
return inner
-def mapping(query, key_func, value_func):
+def mapping(query, key_func=lambda r: r[0], value_func=lambda r: r[1]):
"""
A helper function that takes a query, a key_func, and a value_func and will
created a mapping that maps each row to a key: value pair.
@@ -207,8 +207,6 @@ def get_last_serial(self, name=None):
get_projects_with_serial = db.mapping(
"SELECT name, max(id) FROM journals GROUP BY name",
- key_func=lambda r: r[0],
- value_func=lambda r: r[1],
)
get_project_versions = db.rows(

0 comments on commit b63e16f

Please sign in to comment.