Back to index

moin  1.9.0~rc2
Functions
MoinMoin.events.xapian_index Namespace Reference

Functions

def _get_index
def handle_renamed
def handle_copied
def handle_changed
def handle_deleted
def handle_attachment_change
def handle

Function Documentation

def MoinMoin.events.xapian_index._get_index (   request) [private]

Definition at line 12 of file xapian_index.py.

00012 
00013 def _get_index(request):
00014     try:
00015         from MoinMoin.search.Xapian import XapianIndex
00016         return XapianIndex(request)
00017     except ImportError:
00018         pass
00019 

Here is the caller graph for this function:

Definition at line 71 of file xapian_index.py.

00071 
00072 def handle(event):
00073     if isinstance(event, ev.PageRenamedEvent):
00074         handle_renamed(event)
00075     elif isinstance(event, ev.PageCopiedEvent):
00076         handle_copied(event)
00077     elif isinstance(event, (ev.PageChangedEvent, ev.TrivialPageChangedEvent)):
00078         handle_changed(event)
00079     elif isinstance(event, ev.PageDeletedEvent):
00080         handle_deleted(event)
00081     elif isinstance(event, (ev.FileAttachedEvent, ev.FileRemovedEvent)):
00082         handle_attachment_change(event)
00083 

Here is the call graph for this function:

Updates Xapian index when attachment is added or removed

Definition at line 60 of file xapian_index.py.

00060 
00061 def handle_attachment_change(event):
00062     """Updates Xapian index when attachment is added or removed"""
00063 
00064     request = event.request
00065 
00066     if request.cfg.xapian_search:
00067         index = _get_index(request)
00068         if index and index.exists():
00069             index.update_item(event.pagename, event.filename)
00070 

Here is the call graph for this function:

Here is the caller graph for this function:

Updates Xapian index when a page is changed

Definition at line 43 of file xapian_index.py.

00043 
00044 def handle_changed(event):
00045     """Updates Xapian index when a page is changed"""
00046 
00047     request = event.request
00048 
00049     if request.cfg.xapian_search:
00050         index = _get_index(request)
00051         if index and index.exists():
00052             index.update_item(event.page.page_name)
00053 

Here is the call graph for this function:

Here is the caller graph for this function:

Updates Xapian index when a page is copied

Definition at line 32 of file xapian_index.py.

00032 
00033 def handle_copied(event):
00034     """Updates Xapian index when a page is copied"""
00035 
00036     request = event.request
00037 
00038     if request.cfg.xapian_search:
00039         index = _get_index(request)
00040         if index and index.exists():
00041             index.update_item(event.page.page_name)
00042 

Here is the call graph for this function:

Here is the caller graph for this function:

Updates Xapian index when a page is deleted

Definition at line 54 of file xapian_index.py.

00054 
00055 def handle_deleted(event):
00056     """Updates Xapian index when a page is deleted"""
00057     event = ev.PageChangedEvent(event.request, event.page, event.comment)
00058     handle_changed(event)
00059 

Here is the call graph for this function:

Here is the caller graph for this function:

Updates Xapian index when a page changes its name

Definition at line 20 of file xapian_index.py.

00020 
00021 def handle_renamed(event):
00022     """Updates Xapian index when a page changes its name"""
00023 
00024     request = event.request
00025 
00026     if request.cfg.xapian_search:
00027         index = _get_index(request)
00028         if index and index.exists():
00029             index.update_item(event.old_page.page_name, now=False)
00030             index.update_item(event.page.page_name)
00031 

Here is the call graph for this function:

Here is the caller graph for this function: