Back to index

plone3  3.1.7
Classes | Functions | Variables
wicked.txtfilter Namespace Reference

Classes

class  WickedFilter
class  BrackettedWickedFilter
class  WickedListener
 event handlers ## More...
class  wicked_listener
 hack around fact that functions can not be pickled ## More...
class  bracketted_wicked_listener
class  backlink
class  brackettedbacklink

Functions

def removeParens
def backlink_handler
def filter_list
 toy example code ##

Variables

tuple _marker = object()
tuple pattern1 = re.compile(r'\(\(([\w\W]+?)\)\)')
tuple pattern2 = re.compile(r'\[\[([\w\W]+?)\]\]')
tuple removeParens = staticmethod(removeParens)
 def removeParens(wikilink): wikilink.replace('((', '') wikilink.replace('))', '') return wikilink
 NAME = WickedFilter.name
tuple pattern1_listeners = WickedListener(pattern1)
tuple pattern2_listeners = WickedListener(pattern2)
 BacklinkRegistrationProxy = backlink

Function Documentation

def wicked.txtfilter.backlink_handler (   field,
  event 
)

Definition at line 215 of file txtfilter.py.

00215 
00216 def backlink_handler(field, event):
00217     try:
00218         wicked = utils.getWicked(field, event.instance, event)
00219     except ComponentLookupError:
00220         # no adapter registered for this type currently
00221         # @@ This might be handle better by redispatch
00222         return
00223         
00224     if not event.value:
00225         return
00226 
00227     value = event.value
00228     value_str = value
00229 
00230     try:
00231         # this block handle conversions for file uploads and
00232         # atapi.BaseUnit or any other not quite plain text "value objects"
00233         value_str = getMultiAdapter((value, field), IValueToString)
00234     except ComponentLookupError:
00235         pass
00236 
00237 
00238     found = wicked.findall(value_str)
00239 
00240     if not len(found):
00241         return
00242 
00243     new_links = [wicked.removeParens(link) for link in found]
00244     wicked.manageLinks(new_links)

def wicked.txtfilter.filter_list (   field,
  context,
  event 
)

toy example code ##

example adapter for a one item list for ordering a txtfilter
pipeline involving wicked only.  Practically useless, for example
only

Definition at line 275 of file txtfilter.py.

00275 
00276 def filter_list(field, context, event):
00277     """example adapter for a one item list for ordering a txtfilter
00278     pipeline involving wicked only.  Practically useless, for example
00279     only"""
00280     return [NAME]
def wicked.txtfilter.removeParens (   wikilink)

Definition at line 34 of file txtfilter.py.

00034 
00035 def removeParens(wikilink):
00036     wikilink.replace('((', '')
00037     wikilink.replace('))', '')
00038     wikilink.replace('[[', '')
00039     wikilink.replace(']]', '')
00040     return wikilink


Variable Documentation

tuple wicked.txtfilter._marker = object()

Definition at line 29 of file txtfilter.py.

Definition at line 262 of file txtfilter.py.

Definition at line 157 of file txtfilter.py.

tuple wicked.txtfilter.pattern1 = re.compile(r'\(\(([\w\W]+?)\)\)')

Definition at line 31 of file txtfilter.py.

Definition at line 245 of file txtfilter.py.

tuple wicked.txtfilter.pattern2 = re.compile(r'\[\[([\w\W]+?)\]\]')

Definition at line 32 of file txtfilter.py.

Definition at line 246 of file txtfilter.py.

def removeParens(wikilink): wikilink.replace('((', '') wikilink.replace('))', '') return wikilink

Definition at line 145 of file txtfilter.py.