Пример #1
0
def choice_sequence(path, choice_index=None, template_name=None):
    try:
        choices = import_module_from_path(path)
    except ImportError:
        return '<span class="error">Failed to import %s</span>' % path
    try:
        choice_index = int(choice_index)
    except ValueError:
        choice_index = -1
    template_name = template_name or 'choice/sequence.html'
    template = get_template(template_name)
    return template.render(Context({
        'choices': choices,
        'index': choice_index,
        }))
Пример #2
0
def choice(choice_index, path):
    try:
        choices = import_module_from_path(path)
    except ImportError, e:
        return choice_index