Exemple #1
0
    ("page_menu", "timestamp", unicode, "tmp/page_menu.timestamp"),
)


def _call_conf(cfg, parser):
    cfg.get_static_menu = MenuItem.get_menu
    if cfg.morias_static_menu:
        refresh_menu(cfg, cfg.page_menu_timestamp)


timestamp = -1
static_menu = None

module_right = "menu_modify"
rights.add(module_right)
content_menu.append(Item("/admin/menu", label="Menu", rights=[module_right]))


@app.pre_process()
def load_static_menu(req):
    if req.uri_rule in ("_debug_info_", "_send_file_", "_directory_index_"):
        return  # this methods no need this pre process

    if req.cfg.morias_static_menu:
        refresh_menu(req, req.cfg.page_menu_timestamp)
        req.static_menu.extend(static_menu)


# enddef

Exemple #2
0
    if not cfg.pages_out:
        cfg.pages_runtime = True                # fallback for dynamic page
    if cfg.pages_index_is_root and not cfg.pages_runtime:
        app.set_route('/', root)                # redirect from / to index.html

    if cfg.pages_runtime:                       # auto register pages url
        refresh_page_files(cfg, cfg.pages_timestamp, False)

# enddef _call_conf

timestamp = -1

module_rights = ['pages_listall', 'pages_author', 'pages_modify']
rights.update(module_rights)

content_menu.append(Item('/admin/pages', label="Pages", symbol="files",
                    rights=module_rights))


@app.pre_process()
def corect_page_files(req):
    if req.uri_rule in ('_debug_info_', '_send_file_', '_directory_index_'):
        return  # this methods no need this pre process

    if req.cfg.pages_runtime:
        refresh_page_files(req, req.cfg.pages_timestamp)
# enddef


def refresh_page_files(req, cfg_timestamp, clear=True):
    global timestamp
    check = check_timestamp(req, cfg_timestamp)
Exemple #3
0
app.set_filter('tag', r'[\w\ \&\.]+', uni)


def _call_conf(cfg, parser):
    if cfg.articles_in_menu:
        user_sections.append(Item('/articles', label="Articles"))
    if cfg.articles_is_root:
        app.set_route('/', articles_list_full)

right_editor = 'articles_editor'
right_author = 'articles_author'
module_rights = (right_editor, right_author)
rights.update(module_rights)

content_menu.append(Item('/admin/articles', label="Articles",
                         symbol="articles", rights=module_rights))


@app.route('/admin/articles')
def admin_articles(req):
    check_login(req)
    match_right(req, module_rights)

    show = req.args.getfirst('show', '', uni)

    pager = Pager(sort='desc')
    pager.bind(req.args)

    kwargs = {}

    if show == 'ready':