import os 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 = 'letter_toc.html' extra = { 'index':index, 'packageIndex':packageIndex, 'conf':Conf } 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")