Esempio n. 1
0
def handle_renamed(event):
    """Updates Xapian index when a page changes its name"""

    request = event.request

    if request.cfg.xapian_search:
        from MoinMoin.search.Xapian import Index
        index = Index(request)
        if index.exists():
            index.remove_item(event.old_page.page_name, now=0)
            index.update_page(event.page.page_name)
Esempio n. 2
0
def handle_changed(event, deleted=False):
    """Updates Xapian index when a page is changed"""

    request = event.request

    if request.cfg.xapian_search:
        from MoinMoin.search.Xapian import Index
        index = Index(request)
        if index.exists():
            if deleted:
                index.remove_item(event.page.page_name)
            else:
                index.update_page(event.page.page_name)
Esempio n. 3
0
def _do_del(pagename, request):
    _ = request.getText

    pagename, filename, fpath = _access_file(pagename, request)
    if not request.user.may.delete(pagename):
        return _('You are not allowed to delete attachments on this page.')
    if not filename:
        return # error msg already sent in _access_file

    # delete file
    os.remove(fpath)
    _addLogEntry(request, 'ATTDEL', pagename, filename)

    if request.cfg.xapian_search:
        from MoinMoin.search.Xapian import Index
        index = Index(request)
        if index.exists:
            index.remove_item(pagename, filename)

    upload_form(pagename, request, msg=_("Attachment '%(filename)s' deleted.") % {'filename': filename})