summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-07-07 01:53:03 +0200
committerDan McGee <dan@archlinux.org>2010-07-07 01:53:03 +0200
commitb6fb5e02e5c5868e76eecd93e7d742dcd0a57466 (patch)
tree2af37bfb6a5412e4ddd8bdbaaad4a29c4c277832 /main
parentedfdc2e38bcab6a5efedfd789db24d86205c076a (diff)
downloadarchweb-b6fb5e02e5c5868e76eecd93e7d742dcd0a57466.tar.gz
archweb-b6fb5e02e5c5868e76eecd93e7d742dcd0a57466.tar.xz
Add helper method to package to find self in testing repo
This will be useful in templates getting touched in an upcoming commit. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main')
-rw-r--r--main/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/models.py b/main/models.py
index 8f1d9c9..088d406 100644
--- a/main/models.py
+++ b/main/models.py
@@ -321,6 +321,16 @@ class Package(models.Model):
and self.pkgver == other.pkgver \
and self.pkgrel == other.pkgrel
+ def in_testing(self):
+ '''attempt to locate this package in a testing repo; if we are in
+ a testing repo we will always return None.'''
+ if self.repo.testing:
+ return None
+ try:
+ return Package.objects.get(repo__testing=True,
+ pkgname=self.pkgname, arch=self.arch)
+ except Package.DoesNotExist:
+ return None
class Signoff(models.Model):
pkg = models.ForeignKey(Package)