djeuscan: add euscan result log into a variable

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-07-24 08:07:09 +02:00
parent 6bb42d72fc
commit e0a5308463

View File

@ -1,6 +1,7 @@
""" Views """ """ Views """
import inspect import inspect
import json
from annoying.decorators import render_to, ajax_request from annoying.decorators import render_to, ajax_request
from django.http import Http404 from django.http import Http404
@ -202,6 +203,13 @@ def package(request, category, package):
log = log[0] if log else None log = log[0] if log else None
vlog = VersionLog.objects.for_package(package, order=True) vlog = VersionLog.objects.for_package(package, order=True)
result = json.loads(log.result) if log else None
if result and package.cp() in result:
msg = result[package.cp()]['messages']
else:
msg = ""
try: try:
last_scan = EuscanResult.objects.for_package(package).latest().datetime last_scan = EuscanResult.objects.for_package(package).latest().datetime
except EuscanResult.DoesNotExist: except EuscanResult.DoesNotExist:
@ -242,6 +250,7 @@ def package(request, category, package):
'upstream': upstream, 'upstream': upstream,
'log': log, 'log': log,
'vlog': vlog, 'vlog': vlog,
'msg' : msg,
'last_scan': last_scan, 'last_scan': last_scan,
'favourited': favourited, 'favourited': favourited,
'refreshed': refreshed, 'refreshed': refreshed,