Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
wicked.txtfilter.WickedListener Class Reference

event handlers ## More...

List of all members.

Public Member Functions

def __init__
def render
def store

Public Attributes

 pattern

Detailed Description

event handlers ##

Definition at line 162 of file txtfilter.py.


Constructor & Destructor Documentation

def wicked.txtfilter.WickedListener.__init__ (   self,
  pattern 
)

Definition at line 164 of file txtfilter.py.

00164 
00165     def __init__(self, pattern):
00166         self.pattern = pattern
        

Here is the caller graph for this function:


Member Function Documentation

def wicked.txtfilter.WickedListener.render (   self,
  field,
  instance,
  event 
)
standalone wicked filter (ie not as a txtfilter). Optimal if
not using txtfilters

Definition at line 167 of file txtfilter.py.

00167 
00168     def render(self, field, instance, event):
00169         """standalone wicked filter (ie not as a txtfilter). Optimal if
00170         not using txtfilters"""
00171 
00172         if event.kwargs.get('raw', False):
00173             return 
00174 
00175         wicked = getMultiAdapter((field, instance, event), IWickedFilter)
00176         wicked.pattern = self.pattern
00177         try:
00178             wicked()
00179         except EndFiltrationException:
00180             pass

def wicked.txtfilter.WickedListener.store (   self,
  field,
  event 
)

Definition at line 181 of file txtfilter.py.

00181 
00182     def store(self, field, event):
00183         try:
00184             wicked = utils.getWicked(field, event.instance, event)
00185         except ComponentLookupError:
00186             # no adapter registered for this type currently
00187             # @@ This might be handle better by redispatch
00188             return
00189         
00190         wicked.pattern = self.pattern
00191         if not event.value:
00192             return
00193 
00194         value = event.value
00195         value_str = value
00196 
00197         try:
00198             # this block handle conversions for file uploads and
00199             # atapi.BaseUnit or any other not quite plain text "value objects"
00200             value_str = getMultiAdapter((value, field), IValueToString)
00201         except ComponentLookupError:
00202             pass
00203 
00204         found = wicked.findall(value_str)
00205 
00206         if not len(found):
00207             return
00208 
00209         new_links = [wicked.removeParens(link) for link in found]
00210         wicked.manageLinks(new_links)


Member Data Documentation

Definition at line 165 of file txtfilter.py.


The documentation for this class was generated from the following file: