From 64da32a3f3312331537eb34ab704eec7ebf14221 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 3 Jan 2012 14:17:56 -0600 Subject: Add maintainer and packager data to package JSON view Signed-off-by: Dan McGee --- packages/views/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/views/__init__.py b/packages/views/__init__.py index aa7da262..9f24056a 100644 --- a/packages/views/__init__.py +++ b/packages/views/__init__.py @@ -1,5 +1,6 @@ from django.contrib import messages from django.contrib.auth.decorators import permission_required +from django.contrib.auth.models import User from django.core.serializers.json import DjangoJSONEncoder from django.http import HttpResponse, Http404 from django.shortcuts import get_object_or_404, redirect @@ -27,7 +28,8 @@ class PackageJSONEncoder(DjangoJSONEncoder): pkg_attributes = [ 'pkgname', 'pkgbase', 'repo', 'arch', 'pkgver', 'pkgrel', 'epoch', 'pkgdesc', 'url', 'filename', 'compressed_size', - 'installed_size', 'build_date', 'last_update', 'flag_date' ] + 'installed_size', 'build_date', 'last_update', 'flag_date', + 'maintainers', 'packager' ] def default(self, obj): if hasattr(obj, '__iter__'): @@ -43,6 +45,8 @@ def default(self, obj): return obj.directory + filename if isinstance(obj, (Repo, Arch, PackageGroup)): return obj.name.lower() + elif isinstance(obj, User): + return obj.username return super(PackageJSONEncoder, self).default(obj) def opensearch(request): -- cgit v1.2.3-54-g00ecf