Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add JSON MIME types to HttpResponse in resolve() per digi604's direction

This fixes an issue where the side frame causes redirects to non-sensical URLs of the type: `http://127.0.0.1/en/<html><body>en</body></html>` or similar.
  • Loading branch information...
commit a1650839b6f39f05cd404a02971b2240ca4d9126 1 parent 698fe1c
@mkoistinen mkoistinen authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 cms/admin/pageadmin.py
View
10 cms/admin/pageadmin.py
@@ -1249,14 +1249,14 @@ def add_page_type(self, request):
def resolve(self, request):
if not request.user.is_staff:
- return HttpResponse('')
+ return HttpResponse('', content_type='application/json')
if request.session.get('cms_log_latest', False):
log = LogEntry.objects.get(pk=request.session['cms_log_latest'])
obj = log.get_edited_object()
del request.session['cms_log_latest']
if obj.__class__ in toolbar_pool.get_watch_models() and hasattr(obj, 'get_absolute_url'):
try:
- return HttpResponse(force_unicode(obj.get_absolute_url()))
+ return HttpResponse(force_unicode(obj.get_absolute_url()), content_type='application/json')
except:
pass
pk = request.REQUEST.get('pk')
@@ -1268,9 +1268,9 @@ def resolve(self, request):
try:
instance = ctype.get_object_for_this_type(pk=pk)
except ctype.model_class().DoesNotExist:
- return HttpResponse('/')
- return HttpResponse(force_unicode(instance.get_absolute_url()))
- return HttpResponse('')
+ return HttpResponse('/', content_type='application/json')
+ return HttpResponse(force_unicode(instance.get_absolute_url()), content_type='application/json')
+ return HttpResponse('', content_type='application/json')
def lookup_allowed(self, key, *args, **kwargs):
if key == 'site__exact':
Please sign in to comment.
Something went wrong with that request. Please try again.