def get(self, request, pk=None): embed_url = reverse('asset_embed', args=[pk]) full_url = "{0}://{1}{2}".format(request.scheme, request.META['HTTP_HOST'], embed_url) data = { 'html': '<iframe src="{0}" frameborder="0" width="100%" height="250"></iframe>'.format(full_url), 'version': '1.0', 'type': 'rich', 'height': '250' } json = simplejson.JSONEncoderForHTML().encode(data) return HttpResponse(json, content_type="application/json")
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML()
def render_json(data): encoder = simplejson.JSONEncoderForHTML() return Markup(encoder.encode(data))
def setUp(self): self.decoder = json.JSONDecoder() self.encoder = json.JSONEncoderForHTML() self.non_ascii_encoder = json.JSONEncoderForHTML(ensure_ascii=False)
def json_friendly_transcript(self): return simplejson.JSONEncoderForHTML().encode(self.transcript)