From 71d79f133b8b656f93573569f65a9eab052f0d3f Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sat, 17 Oct 2009 23:47:09 +0200 Subject: Port archweb_pub commit 1f96c7a1182ef75279c18986b708e683f89dd690 to archweb_dev. This is the original commit message by Dan: "Make package SVN links always work This should clean up the links for all varieties of things- different arches (including any), different repos (community and community-testing), and split packages. All of the logic is in one place now and any further changes should be made to the method on the package object." --- main/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'main') diff --git a/main/models.py b/main/models.py index f68e501e..3ab2c368 100644 --- a/main/models.py +++ b/main/models.py @@ -256,6 +256,20 @@ def get_depends(self): self.deps_cache = deps return deps + def get_svn_link(self): + linkbase = "http://repos.archlinux.org/viewvc.cgi/%s/repos/%s-%s/%s" + if self.pkgbase: + dirname = self.pkgbase + else: + dirname = self.pkgname + repo = self.repo.name.lower() + if repo.startswith('community'): + rootopt = '?root=community' + else: + rootopt = '?root=packages' + return linkbase % (dirname, repo, self.arch.name, rootopt) + + class Signoff(models.Model): pkg = models.ForeignKey(Package) pkgver = models.CharField(max_length=255) -- cgit v1.2.3-54-g00ecf