]> git.openstreetmap.org Git - osqa.git/commitdiff
Replace deprecated mimetype with content_type
authorTom Hughes <tom@compton.nu>
Fri, 29 Aug 2014 17:40:08 +0000 (18:40 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 12 May 2015 07:56:36 +0000 (08:56 +0100)
forum/feed.py
forum/sitemap.py
forum/utils/decorators.py
forum/views/commands.py
forum/views/decorators.py
forum/views/meta.py
forum/views/writers.py
forum_modules/akismet/startup.py
forum_modules/exporter/views.py
forum_modules/stats/views.py

index c52e64bf8214b3df9b299cfa8b1d31c50cbf6c88..810a7422f9dac3c92f07e011ec36783ced0ce601 100644 (file)
@@ -63,7 +63,7 @@ class BaseNodeFeed(Feed):
     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
 
index 26e9d18b443fba9230e6e10ab67e4de67c9341aa..0ba045b7bb025e4ede91b6b6c097d74c266e79a8 100644 (file)
@@ -25,7 +25,7 @@ def index(request, sitemaps):
         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:
@@ -46,7 +46,7 @@ def sitemap_section_index(request, section, sitemaps):
         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 = [], []
@@ -68,7 +68,7 @@ def sitemap(request, sitemaps, section=None, page=1):
         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
index 6cc2d5bd9848852bf22c551ed519ddb7657c29d6..18a5826bd8eba5cb40159ff7c7b7a116ea4e92d1 100644 (file)
@@ -7,7 +7,7 @@ def ajax_login_required(view_func):
             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):
@@ -16,10 +16,10 @@ 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
             
index 62d864f80383314eeeb8b1da8a002adb3fb9a910..126faa893dc0aae02dec10079a77545af8320dcc 100644 (file)
@@ -309,7 +309,7 @@ def node_markdown(request, id):
         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)
@@ -547,7 +547,7 @@ def mark_tag(request, tag=None, **kwargs):#tagging system
                 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:
@@ -558,7 +558,7 @@ def matching_tags(request):
     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:
@@ -570,7 +570,7 @@ def matching_users(request):
     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):
@@ -581,7 +581,7 @@ def related_questions(request):
 
         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()
 
index 3bede665ddaf966b54829039accc29d1afb4ec6f..c99377c713b949a865748e7442b96d5bb3feed82 100644 (file)
@@ -49,7 +49,7 @@ class RefreshPageCommand(HttpResponse):
     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:
@@ -77,7 +77,7 @@ def command(func, request, *args, **kwargs):
             }
 
     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', '/'))
 
index e7d151588a8402a6e0c2b73c19cf03b9005e91c0..513fd39465d5d904b89cd41013b9c48690532472 100644 (file)
@@ -28,7 +28,7 @@ def favicon(request):
     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},
@@ -146,7 +146,7 @@ def page(request):
             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')
 
index 597ddbaf09e5234a6f4a78e7e49299c21af947ac..85f40de99774d0b9ef6cb3bfc9fd0278f6620fb5 100644 (file)
@@ -68,7 +68,7 @@ def upload(request):#ajax upload file to a question or answer
     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
index c050754add3acb4ba8ba228383257d1e46d1352d..7600bee1f30370a60319d3bbf09f53e42f645d23 100644 (file)
@@ -51,7 +51,7 @@ def check_spam(param, comment_type):
                     '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:
index c7b3904dae76a70ab916b94babf884d28f1b2409..e6cc57723d463c30fe8b2ca207b9229adf41f34f 100644 (file)
@@ -74,7 +74,7 @@ def running(request, mode):
     })
 
 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):
index 12a58ab9d8febd43a3be1024b570e57b8be24ac7..c052c249b99fb619dea831338509757d2d9e7615 100644 (file)
@@ -17,4 +17,4 @@ def stats_index(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')