Add default charset for Django settings; change from default pdf output to html

svn: r23380
This commit is contained in:
Doug Blank 2013-10-24 11:40:35 +00:00
parent 83fc3ad4e8
commit 39a3f50a96
2 changed files with 13 additions and 2 deletions

View File

@ -206,7 +206,7 @@ def process_report_run(request, handle):
if request.user.is_authenticated():
profile = request.user.get_profile()
report = Report.objects.get(handle=handle)
args = {"off": "pdf", "iff": "ged"} # basic defaults
args = {"off": "html"} # basic defaults
# override from given defaults in table:
if report.options:
for pair in str(report.options).split("\\n"):
@ -268,7 +268,17 @@ def process_report_run(request, handle):
make_message(request, "Failed: '%s' is not found" % filename)
return redirect("/report/")
time.sleep(1)
return send_file(request, filename, mimetype)
# FIXME: the following should go into a queue for later presentation
# like a jobs-result queue
if filename.endswith(".html"):
# just give it, perhaps in a new tab
from django.http import HttpResponse
response = HttpResponse(mimetype="text/html")
content = "".join(open(filename).readlines())
response._set_content(content)
return response
else:
return send_file(request, filename, mimetype)
# If failure, just fail for now:
context = RequestContext(request)
context["message"] = "You need to be logged in to run reports."

View File

@ -156,4 +156,5 @@ CACHES = {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
DEFAULT_CHARSET = "utf-8"
## End Changes for Django 1.5