Back to index

moin  1.9.0~rc2
Namespaces | Classes | Functions | Variables
MoinMoin.action Namespace Reference

Namespaces

namespace  anywikidraw
namespace  AttachFile
namespace  backup
namespace  bookmark
namespace  cache
namespace  chart
namespace  CopyPage
namespace  DeletePage
namespace  Despam
namespace  diff
namespace  edit
namespace  fckdialog
namespace  fullsearch
namespace  info
namespace  language_setup
namespace  LikePages
namespace  Load
namespace  LocalSiteMap
namespace  login
namespace  logout
namespace  MyPages
namespace  newaccount
namespace  newpage
namespace  PackagePages
namespace  pollsistersites
namespace  recoverpass
namespace  refresh
namespace  RenamePage
namespace  RenderAsDocbook
namespace  revert
namespace  rss_rc
namespace  Save
namespace  serveopenid
namespace  showtags
namespace  sisterpages
namespace  sitemap
namespace  SlideShow
namespace  SpellCheck
namespace  subscribe
namespace  SubscribeUser
namespace  supplementation
namespace  SyncPages
namespace  thread_monitor
namespace  titleindex
namespace  twikidraw
namespace  unsubscribe
namespace  userprefs
namespace  userprofile

Classes

class  ActionBase

Functions

def do_raw
def do_show
def do_format
def do_content
def do_print
def do_recall
def do_refresh
def do_goto
def get_names
def getHandler
def get_available_actions

Variables

tuple modules = pysupport.getPackageModules(__file__)
list names = ['show', 'recall', 'raw', 'format', 'content', 'print', 'refresh', 'goto', ]
tuple MIMETYPE_CRE = re.compile('[a-zA-Z0-9.+\-]{1,100}/[a-zA-Z0-9.+\-]{1,100}')

Function Documentation

def MoinMoin.action.do_content (   pagename,
  request 
)
same as do_show, but we only show the content 

Definition at line 273 of file __init__.py.

00273 
00274 def do_content(pagename, request):
00275     """ same as do_show, but we only show the content """
00276     # XXX temporary fix to make it work until Page.send_page gets refactored
00277     request.mimetype = 'text/html'
00278     request.status_code = 200
00279     do_show(pagename, request, count_hit=0, content_only=1)

Here is the call graph for this function:

def MoinMoin.action.do_format (   pagename,
  request 
)
send a page using a specific formatter given by "mimetype=" value.
    Since 5.5.2006 this functionality is also done by do_show, but do_format
    has a default of text/plain when no format is given.
    It also does not count in statistics and also does not set the cacheable flag.
    DEPRECATED: remove this action when we don't need it any more for compatibility.

Definition at line 264 of file __init__.py.

00264 
00265 def do_format(pagename, request):
00266     """ send a page using a specific formatter given by "mimetype=" value.
00267         Since 5.5.2006 this functionality is also done by do_show, but do_format
00268         has a default of text/plain when no format is given.
00269         It also does not count in statistics and also does not set the cacheable flag.
00270         DEPRECATED: remove this action when we don't need it any more for compatibility.
00271     """
00272     do_show(pagename, request, count_hit=0, cacheable=0, mimetype=u'text/plain')

Here is the call graph for this function:

def MoinMoin.action.do_goto (   pagename,
  request 
)
redirect to another page 

Definition at line 302 of file __init__.py.

00302 
00303 def do_goto(pagename, request):
00304     """ redirect to another page """
00305     target = request.values.get('target', '')
00306     request.http_redirect(Page(request, target).url(request))
00307 
# Dispatching ----------------------------------------------------------------

Here is the call graph for this function:

def MoinMoin.action.do_print (   pagename,
  request 
)
same as do_show, but with print_mode set 

Definition at line 280 of file __init__.py.

00280 
00281 def do_print(pagename, request):
00282     """ same as do_show, but with print_mode set """
00283     do_show(pagename, request, print_mode=1)

Here is the call graph for this function:

def MoinMoin.action.do_raw (   pagename,
  request 
)
send raw content of a page (e.g. wiki markup) 

Definition at line 235 of file __init__.py.

00235 
00236 def do_raw(pagename, request):
00237     """ send raw content of a page (e.g. wiki markup) """
00238     if not request.user.may.read(pagename):
00239         Page(request, pagename).send_page()
00240     else:
00241         rev = request.rev or 0
00242         mimetype = request.values.get('mimetype', None)
00243         if mimetype and not MIMETYPE_CRE.match(mimetype):
00244             mimetype = None
00245         Page(request, pagename, rev=rev).send_raw(mimetype=mimetype)

def MoinMoin.action.do_recall (   pagename,
  request 
)
same as do_show, but never caches and never counts hits 

Definition at line 284 of file __init__.py.

00284 
00285 def do_recall(pagename, request):
00286     """ same as do_show, but never caches and never counts hits """
00287     do_show(pagename, request, count_hit=0, cacheable=0)

Here is the call graph for this function:

def MoinMoin.action.do_refresh (   pagename,
  request 
)
Handle refresh action 

Definition at line 288 of file __init__.py.

00288 
00289 def do_refresh(pagename, request):
00290     """ Handle refresh action """
00291     # Without arguments, refresh action will refresh the page text_html cache.
00292     arena = request.values.get('arena', 'Page.py')
00293     if arena == 'Page.py':
00294         arena = Page(request, pagename)
00295     key = request.values.get('key', 'text_html')
00296 
00297     # Remove cache entry (if exists), and send the page
00298     from MoinMoin import caching
00299     caching.CacheEntry(request, arena, key, scope='item').remove()
00300     caching.CacheEntry(request, arena, "pagelinks", scope='item').remove()
00301     do_show(pagename, request)

Here is the call graph for this function:

def MoinMoin.action.do_show (   pagename,
  request,
  content_only = 0,
  count_hit = 1,
  cacheable = 1,
  print_mode = 0,
  mimetype = u'text/html' 
)
show a page, either current revision or the revision given by "rev=" value.
    if count_hit is non-zero, we count the request for statistics.

Definition at line 246 of file __init__.py.

00246 
00247 def do_show(pagename, request, content_only=0, count_hit=1, cacheable=1, print_mode=0, mimetype=u'text/html'):
00248     """ show a page, either current revision or the revision given by "rev=" value.
00249         if count_hit is non-zero, we count the request for statistics.
00250     """
00251     # We must check if the current page has different ACLs.
00252     if not request.user.may.read(pagename):
00253         Page(request, pagename).send_page()
00254     else:
00255         mimetype = request.values.get('mimetype', mimetype)
00256         rev = request.rev or 0
00257         if rev == 0:
00258             request.cacheable = cacheable
00259         Page(request, pagename, rev=rev, formatter=mimetype).send_page(
00260             count_hit=count_hit,
00261             print_mode=print_mode,
00262             content_only=content_only,
00263         )

Here is the caller graph for this function:

def MoinMoin.action.get_available_actions (   config,
  page,
  user 
)
Get a list of actions available on a particular page
for a particular user.

The set does not contain actions that starts with lower case.
Themes use this set to display the actions to the user.

@param config: a config object (for the per-wiki actions)
@param page: the page to which the actions should apply
@param user: the user which wants to apply an action
@rtype: set
@return: set of avaiable actions

Definition at line 340 of file __init__.py.

00340 
00341 def get_available_actions(config, page, user):
00342         """ Get a list of actions available on a particular page
00343         for a particular user.
00344 
00345         The set does not contain actions that starts with lower case.
00346         Themes use this set to display the actions to the user.
00347 
00348         @param config: a config object (for the per-wiki actions)
00349         @param page: the page to which the actions should apply
00350         @param user: the user which wants to apply an action
00351         @rtype: set
00352         @return: set of avaiable actions
00353         """
00354         if not user.may.read(page.page_name):
00355             return []
00356 
00357 
00358         actions = get_names(config)
00359 
00360         # Filter non ui actions (starts with lower case letter)
00361         actions = [action for action in actions if not action[0].islower()]
00362 
00363         # Filter actions by page type, acl and user state
00364         excluded = []
00365         if (page.isUnderlayPage() and not page.isStandardPage()) or \
00366                 not user.may.write(page.page_name) or \
00367                 not user.may.delete(page.page_name):
00368                 # Prevent modification of underlay only pages, or pages
00369                 # the user can't write and can't delete
00370                 excluded = [u'RenamePage', u'DeletePage', ] # AttachFile must NOT be here!
00371         return set([action for action in actions if not action in excluded])
00372 
00373 

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.action.get_names (   config)
Get a list of known actions.

@param config: a config object
@rtype: set
@return: set of known actions

Definition at line 308 of file __init__.py.

00308 
00309 def get_names(config):
00310     """ Get a list of known actions.
00311 
00312     @param config: a config object
00313     @rtype: set
00314     @return: set of known actions
00315     """
00316     if not hasattr(config.cache, 'action_names'):
00317         actions = names[:]
00318         actions.extend(wikiutil.getPlugins('action', config))
00319         actions = set([action for action in actions
00320                       if not action in config.actions_excluded])
00321         config.cache.action_names = actions # remember it
00322     return config.cache.action_names

Here is the caller graph for this function:

def MoinMoin.action.getHandler (   request,
  action,
  identifier = "execute" 
)
return a handler function for a given action or None.

TODO: remove request dependency

Definition at line 323 of file __init__.py.

00323 
00324 def getHandler(request, action, identifier="execute"):
00325     """ return a handler function for a given action or None.
00326 
00327     TODO: remove request dependency
00328     """
00329     cfg = request.cfg
00330     # check for excluded actions
00331     if action in cfg.actions_excluded:
00332         return None
00333 
00334     try:
00335         handler = wikiutil.importPlugin(cfg, "action", action, identifier)
00336     except wikiutil.PluginMissingError:
00337         handler = globals().get('do_' + action)
00338 
00339     return handler


Variable Documentation

tuple MoinMoin.action.MIMETYPE_CRE = re.compile('[a-zA-Z0-9.+\-]{1,100}/[a-zA-Z0-9.+\-]{1,100}')

Definition at line 233 of file __init__.py.

tuple MoinMoin.action.modules = pysupport.getPackageModules(__file__)

Definition at line 38 of file __init__.py.

list MoinMoin.action.names = ['show', 'recall', 'raw', 'format', 'content', 'print', 'refresh', 'goto', ]

Definition at line 41 of file __init__.py.