예제 #1
0
파일: page.py 프로젝트: mixerlabs/widgets
    def render_readonly(self):
        """Render a version of onecolumn as a snippet of formatted html."""
        title   = 'Untitled' if not self.title else self.title
        contents = ''.join(map(self.render_widget_readonly, self.ordered))

        return django_render_to_string('widgets/onecolumn_readonly.html',
                                       dict(title=title, contents=contents))
예제 #2
0
 def render_to_string(template_name, context=None, request=None):
     if request is not None:
         context_instance = RequestContext(request, context)
     else:
         context_instance = Context(context)
     return django_render_to_string(template_name,
                                    context_instance=context_instance)
예제 #3
0
 def render_to_string(template_name, context=None, request=None):
     if request is not None:
         context_instance = RequestContext(request, context)
     else:
         context_instance = Context(context)
     return django_render_to_string(template_name,
                                    context_instance=context_instance)
예제 #4
0
def render_django(template, context, context_update):
    if not isinstance(context, Context):
        if 'request' in context:
            context = RequestContext(context['request'], context)
        else:
            context = Context(context)

    with context.push(context_update):
        return django_render_to_string(template, context)
예제 #5
0
def render_to_string(template, *args, **kwargs):
    """Wrapper around django.template.loader.render_to_string which supports
  different template libraries."""
    template_lib = _get_template_lib(template, kwargs)
    if template_lib == DJANGO:
        return django_render_to_string(template, *args, **kwargs)
    elif template_lib == MAKO:
        return django_mako.render_to_string(template, *args, **kwargs)
    else:
        raise Exception("Bad template lib: %s" % template_lib)
예제 #6
0
파일: django_util.py 프로젝트: atm/hue
def render_to_string(template, *args, **kwargs):
  """Wrapper around django.template.loader.render_to_string which supports
  different template libraries."""
  template_lib = _get_template_lib(template, kwargs)
  if template_lib == DJANGO:
    return django_render_to_string(template, *args, **kwargs)
  elif template_lib == MAKO:
    return django_mako.render_to_string(template, *args, **kwargs)
  else:
    raise Exception("Bad template lib: %s" % template_lib)
예제 #7
0
파일: page.py 프로젝트: mixerlabs/widgets
    def render_embed(self, about, city_layout=False):
        """Render a version of onecolumn embeddable by city, business
        pages, etc.  If city_layout is True, use an alternate layout that
        doesn't use a header bar for the embed. """
        template, context = \
            self.base_template_and_context('widgets/onecolumn_embed.html')
        context['about'] = about
        context['city_layout'] = city_layout

        return django_render_to_string(template, context)
예제 #8
0
def render_to_string(template_name, dictionary=None, context_instance=None):
    if not dictionary:
        dictionary = {}

    if isinstance(dictionary, dict):
        newdict = get_branding_dict("BRANDING")
        newdict.update(dictionary)
    else:
        newdict = dictionary

    return django_render_to_string(template_name, newdict, context_instance)
예제 #9
0
def render_to_string(templ, context):
    context.update({
        'PROJECT_TITLE': settings.PROJECT_TITLE,
        'PROJECT_STRAPLINE': settings.PROJECT_STRAPLINE,
    })
    return django_render_to_string(templ, context)
예제 #10
0
파일: plugins.py 프로젝트: ximion/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    from misago.template.theme import prefix_templates
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name,
                                   dictionary,
                                   context_instance=context_instance)
예제 #11
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
예제 #12
0
파일: loader.py 프로젝트: ximion/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    dictionary = process_context(template_name, dictionary, context_instance)
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name, dictionary)
예제 #13
0
def render_to_string(template, context):
    html = django_render_to_string(template, context)
    assert "This_is_not_INVALID" not in html
    return html
예제 #14
0
def render_to_string(template_name, dictionary=None, context_instance=None, dirs=None):
    if context_instance is None:
        request = get_request()
        if request is not None:
            context_instance = RequestContext(request)
    return django_render_to_string(template_name, dictionary, context_instance, dirs)
예제 #15
0
파일: plugins.py 프로젝트: 0x1330/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    from misago.template.theme import prefix_templates
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name,
                                   dictionary,
                                   context_instance=context_instance)
예제 #16
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
예제 #17
0
파일: page.py 프로젝트: mixerlabs/widgets
 def get_edit_info(self):
     return django_render_to_string(
         'widgets/_onecolumn_edit_info.html', {'page': self})
예제 #18
0
파일: views.py 프로젝트: Saevon/webdnd
def render_to_string(template_name, *args, **kwargs):
    return django_render_to_string(template_name, *args, **kwargs)