diff options
-rw-r--r-- | main/models.py | 14 | ||||
-rw-r--r-- | packages/views.py | 3 | ||||
-rw-r--r-- | templates/packages/details.html | 2 |
3 files changed, 16 insertions, 3 deletions
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 @@ class Package(models.Model): 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) diff --git a/packages/views.py b/packages/views.py index e17a4d40..2390bd97 100644 --- a/packages/views.py +++ b/packages/views.py @@ -50,9 +50,8 @@ def details(request, name='', repo='', arch=''): if all([name, repo, arch]): pkg= get_object_or_404(Package, pkgname=name, repo__name__iexact=repo, arch__name=arch) - rootopt = '?root=community' if repo == 'community' else '' return render_to_response('packages/details.html', RequestContext( - request, {'pkg': pkg, 'rootopt': rootopt})) + request, {'pkg': pkg, })) else: return HttpResponseRedirect("/packages/?arch=%s&repo=%s&q=%s" % ( arch.lower(), repo.title(), name)) diff --git a/templates/packages/details.html b/templates/packages/details.html index 71218ead..30c8f6a4 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -7,7 +7,7 @@ <h2 class="title">{{ pkg.pkgname }} {{ pkg.pkgver }}-{{ pkg.pkgrel }}</h2> <div style="float:right" class="listing"> <ul class="small"> - <li><a href="http://repos.archlinux.org/viewvc.cgi/{{ pkg.pkgname }}/repos/{{ pkg.repo.name|lower }}-{{ pkg.arch.name|lower }}/{{ rootopt }}">View SVN Entries</a></li> + <li><a href="{{ pkg.get_svn_link }}">View SVN Entries</a></li> <!-- <li><a href="/packages/files/{{ pkg.id }}/">View File List</a></li> --> {% if pkg.needupdate %} <li> |