Esempio n. 1
0
def response(context, req):
    """The user selected a wiki.  Display a list of reports that can be
       run on this wiki.
    """
    try:
        wiki = req.params['wiki']
        t = req.prepare_template(SelectReport)

        # The user can input either a domain or a dbname
        # in the wiki selection box; we accept either.
        try:
            t.wiki = repdb.find_wiki_domain(context, wiki)
        except ValueError:
            if wiki[-2:] != "_p":
                wiki += "_p"
            t.wiki = repdb.find_wiki(context, wiki)
            wiki = t.wiki['domain']

        cats = {}
        for k in context.reports.keys():
            r = context.reports[k]
            if not r.runs_on(t.wiki['domain']):
                continue
            catname = req.i18n.report_category(r)
            if not cats.has_key(catname):
                cats[catname] = []
            cats[catname].append(r)
        t.categories = cats
        cache = QueryCache(context)
        t.cache_status = cache.check_cache(t.wiki['dbname'], context.reports.values())
        output = str(t)

        req.start_response('200 OK', [('Content-Type', 'text/html; charset=UTF-8')])
        yield output
    except Exception, value:
        yield req.error(str(value))
Esempio n. 2
0
def update_report(wiki, report, parameters):
    from QueryCache import QueryCache
    context = get_context()

    cache = QueryCache(context)
    cache.update_report(wiki, report, parameters)
Esempio n. 3
0
def update_report(wiki, report, parameters):
    from QueryCache import QueryCache
    context = get_context()

    cache = QueryCache(context)
    cache.update_report(wiki, report, parameters)