diff options
author | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-07-30 16:02:51 +0200 |
---|---|---|
committer | Stanislav Ochotnicky <sochotnicky@gmail.com> | 2009-07-30 18:57:50 +0200 |
commit | 3ca2a748bad2f650d1e48778c19a0222ace28f41 (patch) | |
tree | 3c2f5ef91bb608867c1dd885331928c921724d02 /src | |
parent | Add current profile name to package info (diff) | |
download | collagen-3ca2a748bad2f650d1e48778c19a0222ace28f41.tar.gz collagen-3ca2a748bad2f650d1e48778c19a0222ace28f41.tar.bz2 collagen-3ca2a748bad2f650d1e48778c19a0222ace28f41.zip |
Added function to db layer to get package version
Diffstat (limited to 'src')
-rw-r--r-- | src/matchbox/db/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/matchbox/db/__init__.py b/src/matchbox/db/__init__.py index dc2171c..347236a 100644 --- a/src/matchbox/db/__init__.py +++ b/src/matchbox/db/__init__.py @@ -196,6 +196,16 @@ class DjangoDB(object): return v.id @dbquery + def get_package_version(self, package_id, category_id, version): + p = Package.objects.get(pk=package_id) + c = PackageCategory.objects.get(pk=category_id) + + v = PackageVersion.objects.filter(version=version, category=c, package=p) + if len(v) > 0: + return v[0].id + return None + + @dbquery def add_dependency(self, packageversion_id, dependency_id): p = Package.objects.get(pk=packageversion_id) dep = Package.objects.get(pk=dependency_id) |