Exemple #1
0
def render_text(template_name, extra_vars=None, cache_force=None):
    ''' Helper function to render a genshi NewTextTemplate without
    having to pass the loader_class or method. '''
    return render(template_name,
                  extra_vars=extra_vars,
                  cache_force=cache_force,
                  method='text',
                  loader_class=NewTextTemplate)
Exemple #2
0
def render_text(template_name, extra_vars=None, cache_force=None):
    ''' Helper function to render a genshi NewTextTemplate without
    having to pass the loader_class or method. '''
    return render(template_name,
                  extra_vars=extra_vars,
                  cache_force=cache_force,
                  method='text',
                  loader_class=NewTextTemplate)
Exemple #3
0
def render_snippet(template_name, **kw):
    """ Helper function for rendering snippets. Rendered html has
    comment tags added to show the template used. NOTE: unlike other
    render functions this takes a list of keywords instead of a dict for
    the extra template variables. """
    # allow cache_force to be set in render function
    cache_force = kw.pop("cache_force", None)
    output = render(template_name, extra_vars=kw, cache_force=cache_force, renderer="snippet")
    output = "\n<!-- Snippet %s start -->\n%s\n<!-- Snippet %s end -->\n" % (template_name, output, template_name)
    return literal(output)
Exemple #4
0
def render_snippet(template_name, **kw):
    ''' Helper function for rendering snippets. Rendered html has
    comment tags added to show the template used. NOTE: unlike other
    render functions this takes a list of keywords instead of a dict for
    the extra template variables. '''
    # allow cache_force to be set in render function
    cache_force = kw.pop('cache_force', None)
    output = render(template_name,
                    extra_vars=kw,
                    cache_force=cache_force,
                    renderer='snippet')
    output = '\n<!-- Snippet %s start -->\n%s\n<!-- Snippet %s end -->\n' % (
        template_name, output, template_name)
    return literal(output)
Exemple #5
0
def hello2():
    return render("page2")
Exemple #6
0
def root():
    todos = Todo.all()
    return render("home", todos=todos)
    # Setting random seed
    random.seed(configure.config["Random"]["randomseed"])

    # Declaring global variables
    framecount = 0
    particles, agg = set(configure.starting_parts), set(configure.starting_agg)

    startlog()
    # Printing initial data to console
    print("\rDotcount: {0}\tAggsize: {1}\tFramecount: {2:07d}\t".format(
        len(particles), len(agg), 0),
          end="")

    # Taking a still of the starting conditions
    still(particles, agg, "0")
    # Check to see if it is supposed to animate, if so call the render func
    if configure.animate:
        render(particles, agg)
    # If no animation, then start a while loop that calls the advance func
    else:
        snagframe = next(configure.frames_to_snag)
        while not terminate_condition(framecount, agg):
            particles, agg = advance(particles, agg, framecount)
            framecount += 1
            if framecount == snagframe:
                still(particles, agg, str(framecount))
                snagframe = next(configure.frames_to_snag)

    endlog(particles, agg, framecount)
Exemple #8
0
def index():
    return render('index.html')