Exemple #1
0
def _call_conf(cfg, parser):
    def empty(req):
        return ()

    rights.update(cfg.pages_rights)
    if 'get_static_menu' not in cfg.__dict__:
        cfg.get_static_menu = empty             # set empty static menu
    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)
Exemple #2
0
    if 'get_static_menu' not in cfg.__dict__:
        cfg.get_static_menu = empty             # set empty static menu
    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