コード例 #1
0
ファイル: compile_embed.py プロジェクト: pombredanne/unisubs
 def _output_embed_to_dir(self, output_dir, version=''):
     file_name = 'embed{0}.js'.format(version)
     context = widget.embed_context()
     rendered = render_to_string(
         'widget/{0}'.format(file_name), context)
     with open(join(output_dir, file_name), 'w') as f:
         f.write(rendered)
コード例 #2
0
def embed(request, version_no=''):
    """
    This is for serving embed when in development since the compilation
    with the media url hasn't taken place.
    Public clients will use the url : SITE_MEDIA/embed.js
    """
    context = widget.embed_context()
    if bool(version_no) is False:
        version_no = ""
    return render_to_response('widget/embed{0}.js'.format(version_no), 
                              context,
                              context_instance=RequestContext(request),
                              mimetype='text/javascript')
コード例 #3
0
def embed(request, version_no=''):
    """
    This is for serving embed when in development since the compilation
    with the media url hasn't taken place.
    Public clients will use the url : SITE_MEDIA/embed.js
    """
    context = widget.embed_context()

    if bool(version_no) is False:
        version_no = ""
    return render(request,
                  'widget/embed{0}.js'.format(version_no),
                  context,
                  content_type='text/javascript')
コード例 #4
0
ファイル: compile_embed.py プロジェクト: forknfork/unisubs
 def _output_embed_to_dir(self, output_dir, version=''):
     file_name = 'embed{0}.js'.format(version)
     context = widget.embed_context()
     rendered = render_to_string('widget/{0}'.format(file_name), context)
     with open(join(output_dir, file_name), 'w') as f:
         f.write(rendered)