if old_version:
def __call__(self, request):
feedgen = self.get_feed('')
- response = HttpResponse(mimetype=feedgen.mime_type)
+ response = HttpResponse(content_type=feedgen.mime_type)
feedgen.write(response, 'utf-8')
return response
sites.append(final_url)
xml = loader.render_to_string('sitemap_index.xml', {'sitemaps': sites})
- return HttpResponse(xml, mimetype='application/xml')
+ return HttpResponse(xml, content_type='application/xml')
def sitemap_section_index(request, section, sitemaps):
try:
locations.append(location)
xml = loader.render_to_string('sitemap_section_index.xml', { 'locations' : locations, })
- return HttpResponse(xml, mimetype='application/xml')
+ return HttpResponse(xml, content_type='application/xml')
def sitemap(request, sitemaps, section=None, page=1):
maps, urls = [], []
except PageNotAnInteger:
raise Http404("No page '%s'" % page)
xml = smart_str(loader.render_to_string('sitemap.xml', {'urlset': urls}))
- return HttpResponse(xml, mimetype='application/xml')
+ return HttpResponse(xml, content_type='application/xml')
class OsqaSitemap(Sitemap):
limit = QUESTIONS_SITEMAP_LIMIT
return view_func(request,*args,**kwargs)
else:
json = json.dumps({'login_required':True})
- return HttpResponseForbidden(json, mimetype='application/json')
+ return HttpResponseForbidden(json, content_type='application/json')
return wrap
def ajax_method(view_func):
raise Http404
retval = view_func(request,*args,**kwargs)
if isinstance(retval, HttpResponse):
- retval.mimetype = 'application/json'
+ retval.content_type = 'application/json'
return retval
else:
json = json.dumps(retval)
- return HttpResponse(json, mimetype='application/json')
+ return HttpResponse(json, content_type='application/json')
return wrap
raise AnonymousNotAllowedException(_('accept answers'))
node = get_object_or_404(Node, id=id)
- return HttpResponse(node.active_revision.body, mimetype="text/plain")
+ return HttpResponse(node.active_revision.body, content_type="text/plain")
@decorate.withfn(command)
pass
else:
ts.update(reason=reason)
- return HttpResponse(json.dumps(''), mimetype="application/json")
+ return HttpResponse(json.dumps(''), content_type="application/json")
def matching_tags(request):
if len(request.GET['q']) == 0:
for tag in possible_tags:
tag_output += "%s|%s|%s\n" % (tag.id, tag.name, tag.used_count)
- return HttpResponse(tag_output, mimetype="text/plain")
+ return HttpResponse(tag_output, content_type="text/plain")
def matching_users(request):
if len(request.GET['q']) == 0:
for user in possible_users:
output += ("%s|%s|%s\n" % (user.id, user.decorated_name, user.reputation))
- return HttpResponse(output, mimetype="text/plain")
+ return HttpResponse(output, content_type="text/plain")
def related_questions(request):
if request.POST and request.POST.get('title', None):
return HttpResponse(json.dumps(
[dict(title=q.title, url=q.get_absolute_url(), score=q.score, summary=q.summary)
- for q in questions.filter_state(deleted=False)[0:10]]), mimetype="application/json")
+ for q in questions.filter_state(deleted=False)[0:10]]), content_type="application/json")
else:
raise Http404()
def __init__(self):
super(RefreshPageCommand, self).__init__(
content=json.dumps({'commands': {'refresh_page': []}, 'success': True}),
- mimetype="application/json")
+ content_type="application/json")
def command(func, request, *args, **kwargs):
try:
}
if request.is_ajax():
- return HttpResponse(json.dumps(response), mimetype="application/json")
+ return HttpResponse(json.dumps(response), content_type="application/json")
else:
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
return HttpResponseRedirect(str(settings.APP_FAVICON))
def custom_css(request):
- return HttpResponse(or_preview(settings.CUSTOM_CSS, request), mimetype="text/css")
+ return HttpResponse(or_preview(settings.CUSTOM_CSS, request), content_type="text/css")
def static(request, title, content):
return render_to_response('static.html', {'content' : content, 'title': title},
sidebar = mark_safe(sidebar)
else:
- return HttpResponse(page.body, mimetype=page.extra.get('mimetype', 'text/html'))
+ return HttpResponse(page.body, content_type=page.extra.get('mimetype', 'text/html'))
render = page.extra.get('render', 'markdown')
except Exception, e:
result = xml_template % ('', _('Error uploading file. Please contact the site administrator. Thank you. %s' % e), '')
- return HttpResponse(result, mimetype="application/xml")
+ return HttpResponse(result, content_type="application/xml")
def ask(request):
form = None
'success': False,
'error_message': _("Sorry, but akismet thinks your %s is spam.") % comment_type
}
- return HttpResponse(json.dumps(response), mimetype="application/json")
+ return HttpResponse(json.dumps(response), content_type="application/json")
else:
captcha_checked = False
try:
})
def state(request):
- return HttpResponse(json.dumps(cache.get(CACHE_KEY)), mimetype="application/json")
+ return HttpResponse(json.dumps(cache.get(CACHE_KEY)), content_type="application/json")
@admin_page
def download(request):
def stats_check(request):
update_status = check_for_updates()
- return HttpResponse(update_status, mimetype='text/html')
+ return HttpResponse(update_status, content_type='text/html')