Ejemplo n.º 1
0
    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))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
    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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
Ejemplo n.º 12
0
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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 15
0
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)
Ejemplo n.º 16
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
Ejemplo n.º 17
0
 def get_edit_info(self):
     return django_render_to_string(
         'widgets/_onecolumn_edit_info.html', {'page': self})
Ejemplo n.º 18
0
def render_to_string(template_name, *args, **kwargs):
    return django_render_to_string(template_name, *args, **kwargs)