Exemple #1
0
def index(page=1):
    pageCount = current_app.get_option('pageCount') or 20
    archives  = ctx.plugin_manager.do_action(
                        'system.show.archives',
                        page=page,
                        appid=current_app.id
                        pageCount = pageCount
                )
    if archives:
        return  ctx.render('index',archives=ArchiveStock(archives),page=page)
    return ctx.render('text',**{'name':'index'})
Exemple #2
0
def index(page=1):
    page = int(page)
    page_count = current_app.get_option('pageCount') or 2
    totle_count = ctx.plugin_manager.do_action('system.archives.count',
                                               appid=current_app.id,
                                               status='post'
                                               )
    if totle_count and int(totle_count) >0:
        archives  = ctx.plugin_manager.do_action(
                            'system.show.archives',
                            offset = (page*page_count)-page_count,
                            appid=current_app.id,
                            limit = page_count
                            )
        if archives:
            return  ctx.render('index',archives=WappedPool(archives,WappedArchive),page=Page(totle_count,page,page_count,ctx.index_url_for))
    else:
        return ctx.render('index')
Exemple #3
0
def before_request():
    from alien import ctx, current_app, session
    for  s in  default_route_funcs:
        setattr(ctx,'%s_url_for' %s ,
                    current_app.options['__%s_url_for__' %s].apply)
    setattr(ctx, 'plugin_manager', pm)
    setattr(ctx, 'db', schema.session)
    template_engine = None
    with render_lock:
        template_engine = renders.get(current_app.name, None)
    if not template_engine:
        template_engine = jinja2Template(
                                    lookup=['themes/%s' % current_app.get_option('theme')],
                                    globals={
                                        'session':session,
                                        '_option':current_app.get_option,
                                        'Widget':pm.find_widget,
                                        '_footer':footer
                                    })
    renders[current_app.name] = template_engine
    setattr(ctx, 'render', template_engine.render)
    setattr(ctx,'_js',register_js)
    setattr(ctx,'__alien_request_start_time__',time.time())