Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.macro.LikePages Namespace Reference

Functions

def macro_LikePages

Variables

list Dependencies = ['namespace']

Function Documentation

def MoinMoin.macro.LikePages.macro_LikePages (   macro,
  text = u'(none)' 
)

Definition at line 13 of file LikePages.py.

00013 
00014 def macro_LikePages(macro, text=u'(none)'):
00015     request = macro.request
00016     # we don't want to spend much CPU for spiders requesting nonexisting pages
00017     if not request.isSpiderAgent:
00018         pagename = macro.formatter.page.page_name
00019 
00020         # Get matches
00021         start, end, matches = LikePages.findMatches(pagename, request)
00022 
00023         # Render matches
00024         if matches and not isinstance(matches, (str, unicode)):
00025             return request.redirectedOutput(LikePages.showMatches, pagename, request, start, end, matches, False)
00026         else:
00027             # if we did not find any similar pages, we just render the text we got as argument:
00028             return request.formatter.text(text)
00029     # bots get nothing:
00030     return ''
00031 

Variable Documentation

Definition at line 9 of file LikePages.py.