import os import django.db.models import django.http import django.shortcuts import django.template import ComplexQueries import Conf import models def package_vers(request, package, version): pkg = models.SourcePackage.objects.get( name=package, version=version ) ctx = django.template.RequestContext(request) tmpl = 'package_vers.html' extra = { 'pkg':pkg, 'ctx':ctx, 'conf':Conf } return django.shortcuts.render_to_response(tmpl, extra, context_instance=ctx) def display_toc(request, index): packageIndex = ComplexQueries.PackageIndex(index) tmpl = 'searchresults.html' searchDescription = "Packages by index" extra = { 'index':index, 'packageIndex':packageIndex, 'conf':Conf, 'searchDescription':searchDescription, 'searchKey':index } return django.shortcuts.render_to_response(tmpl, extra) def maintainer_search(request, maintainer): mappings = models.SourcePackageMapping.objects.order_by('package__name').filter( django.db.models.Q(package__maintainer__contains=maintainer) | django.db.models.Q(package__uploaders__contains=maintainer ) ) packageIndex = ComplexQueries.PackageIndexQuery( mappings ) tmpl = 'searchresults.html' searchDescription = "Maintainer email" extra = { 'index':maintainer, 'packageIndex':packageIndex, 'conf':Conf, 'searchDescription':searchDescription, 'searchKey':maintainer } return django.shortcuts.render_to_response(tmpl, extra) def display_patch(request, patchType, package, version, patchName): pkg = models.SourcePackage.objects.get( name=package, version=version ) ctx = django.template.RequestContext(request) tmpl = 'patch_view.html' if patchType == "debianonly": patch = pkg.diffhandler().debiandir() patchTitle = "debian-dir only changes" elif patchType == "misc": patch = pkg.diffhandler().filterdiff(include=patchName) patchTitle = patchName elif patchType == "nondebian": patch = pkg.diffhandler().nondebiandir() patchTitle = "direct (non-packaging) changes" elif patchType == "series": patch = pkg.diffhandler().series().fetch(patchName) patchTitle = patchName extra = { 'pkg':pkg, 'patch':patch, 'patchType':patchType, 'conf':Conf, 'patchName':patchName, 'patchTitle':patchTitle } return django.shortcuts.render_to_response(tmpl, extra, context_instance=ctx) def download_patch(request, patchType, package, version, patchName): pkg = models.SourcePackage.objects.get( name=package, version=version ) if patchType == "debianonly": patch = pkg.diffhandler().debiandir() elif patchType == "misc": patch = pkg.diffhandler().filterdiff(include=patchName) elif patchType == "nondebian": patch = pkg.diffhandler().nondebiandir() elif patchType == "series": patch = pkg.diffhandler().series().fetch(patchName) return django.http.HttpResponse(patch, mimetype="text/plain")