Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
wicked.txtfilter.WickedFilter Class Reference
Inheritance diagram for wicked.txtfilter.WickedFilter:
Inheritance graph
[legend]
Collaboration diagram for wicked.txtfilter.WickedFilter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def scope
def normalize
def encoding
def filtered_text
def getLinks
def resolver
def backlinker
def manageLink
def unlink
def manageLinks
def cache
def renderer
def __call__
def findall
def patterns
def chunks
def dynamic
def filtered_chunks

Public Attributes

 section
 pattern
 context
 field
 event

Static Public Attributes

string name = 'Wicked Filter'
 query_iface = IWickedQuery
tuple getMatch = staticmethod(utils.getMatch)

Private Member Functions

def _filterCore

Static Private Attributes

string _encoding = 'UTF8'
tuple _normalize = staticmethod(normalize)

Detailed Description

Definition at line 41 of file txtfilter.py.


Constructor & Destructor Documentation

def wicked.txtfilter.WickedFilter.__init__ (   self,
  field,
  instance,
  event 
)

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Definition at line 51 of file txtfilter.py.

00051 
00052     def __init__(self, field, instance, event):
00053         super(WickedFilter, self).__init__(field, instance, event)
00054         self.section = field.__name__
00055         self.pattern = None

Here is the caller graph for this function:


Member Function Documentation

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Definition at line 136 of file txtfilter.py.

00136 
00137     def __call__(self):
00138         if self.event.kwargs.get('raw', False):
00139             raise EndFiltrationException('Kwargs flag for raw return')
00140         super(WickedFilter, self).__call__()

Here is the caller graph for this function:

def wicked.txtfilter.WickedFilter._filterCore (   self,
  chunk,
  kwargs 
) [private]
Subclasses override this to provide specific impls

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Definition at line 81 of file txtfilter.py.

00081 
00082     def _filterCore(self, chunk, **kwargs):
00083         normalled = self.normalize(chunk)
00084         links=self.getLinks(chunk, normalled)
00085         self.renderer.load(links, chunk)
00086         return self.renderer().encode(self.encoding)

Here is the call graph for this function:

Definition at line 110 of file txtfilter.py.

00110 
00111     def backlinker(self):
00112         return getMultiAdapter((self, self.context), IBacklinkManager)

Definition at line 123 of file txtfilter.py.

00123 
00124     def cache(self):
00125         return getMultiAdapter((self, self.context), ICacheManager)
    
Simple text replacement via co-op with the modules

Definition at line 61 of file txtfilter.py.

00061 
00062     def chunks(self):
00063         """Simple text replacement via co-op with the modules"""
00064         for pattern in self.patterns:
00065             val=pattern.split(self.event.value)
00066             if len(val)>1:
00067                 return val
00068         return val

Here is the call graph for this function:

Here is the caller graph for this function:

tricky ben saller split

Definition at line 70 of file txtfilter.py.

00070 
00071     def dynamic(self):
00072         """tricky ben saller split"""
00073         return self.chunks[1::2]

Here is the call graph for this function:

Here is the caller graph for this function:

AT hack

Definition at line 73 of file txtfilter.py.

00073 
00074     def encoding(self):
00075         """AT hack"""
00076         try:
00077             encoding = self.context.getCharset()
00078         except AttributeError:
00079             encoding = self._encoding
00080         return encoding
    

Here is the caller graph for this function:

Definition at line 75 of file txtfilter.py.

00075 
00076     def filtered_chunks(self):
00077         return [self._filterCore(d, **self.event.kwargs) for d in self.dynamic]

Here is the call graph for this function:

Here is the caller graph for this function:

syntax preprocessing

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Definition at line 88 of file txtfilter.py.

00088 
00089     def filtered_text(self):
00090         """syntax preprocessing"""
00091         return super(WickedFilter, self).filtered_text
    
def wicked.fieldevent.txtfilter.TxtFilter.findall (   self,
  value 
) [inherited]

Definition at line 47 of file txtfilter.py.

00047 
00048     def findall(self, value):
00049         for pattern in self.patterns:
00050             val = pattern.findall(value)
00051             if len(val):
00052                 return val
00053         return val
        

Here is the call graph for this function:

def wicked.txtfilter.WickedFilter.getLinks (   self,
  chunk,
  normalled 
)

Definition at line 94 of file txtfilter.py.

00094 
00095     def getLinks(self, chunk, normalled):
00096         self.resolver.configure(chunk, normalled, self.scope)
00097         brains = self.resolver.search
00098         if not brains:
00099             brains = self.resolver.scopedSearch
00100         links = [utils.packBrain(b) for b in brains if b]
00101         return links

Here is the call graph for this function:

Here is the caller graph for this function:

def wicked.txtfilter.WickedFilter.manageLink (   self,
  obj,
  link 
)

Definition at line 113 of file txtfilter.py.

00113 
00114     def manageLink(self, obj, link):
00115         self.backlinker.manageLink(obj, link)

def wicked.txtfilter.WickedFilter.manageLinks (   self,
  links 
)

Definition at line 119 of file txtfilter.py.

00119 
00120     def manageLinks(self, links):
00121         self.backlinker.manageLinks(links)
        
def wicked.txtfilter.WickedFilter.normalize (   self,
  value 
)

Definition at line 69 of file txtfilter.py.

00069 
00070     def normalize(self, value):
00071         return self._normalize(value)

Here is the caller graph for this function:

Definition at line 55 of file txtfilter.py.

00055 
00056     def patterns(self):
00057         if not isinstance(self.pattern, list):
00058             return [self.pattern]
00059         return self.pattern

Here is the caller graph for this function:

Definition at line 127 of file txtfilter.py.

00127 
00128     def renderer(self):
00129         # @@ better way to get request? maybe a txtfilter should be a view?
00130         renderer = getMultiAdapter((self.context, self.context.REQUEST), Interface, 'link_renderer')
00131         renderer.section = self.section
00132         # hook for zope2 aq wrapper
00133         if hasattr(renderer, '__of__'):
00134             return renderer.__of__(self.context)
00135         return renderer

Here is the caller graph for this function:

@return query object

Definition at line 103 of file txtfilter.py.

00103 
00104     def resolver(self):
00105         """
00106         @return query object
00107         """
00108         return self.query_iface(self.context)

Definition at line 57 of file txtfilter.py.

00057 
00058     def scope(self):
00059         try:
00060             return getMultiAdapter((self.field, self.context), IScope)
00061         except ComponentLookupError:
00062             return ''

Here is the caller graph for this function:

def wicked.txtfilter.WickedFilter.unlink (   self,
  uid 
)

Definition at line 116 of file txtfilter.py.

00116 
00117     def unlink(self, uid):
00118         self.backlinker.unlink(uid)
        

Member Data Documentation

string wicked.txtfilter.WickedFilter._encoding = 'UTF8' [static, private]

Definition at line 49 of file txtfilter.py.

tuple wicked.txtfilter.WickedFilter._normalize = staticmethod(normalize) [static, private]

Definition at line 65 of file txtfilter.py.

Definition at line 42 of file txtfilter.py.

Definition at line 44 of file txtfilter.py.

Definition at line 43 of file txtfilter.py.

Definition at line 64 of file txtfilter.py.

string wicked.txtfilter.WickedFilter.name = 'Wicked Filter' [static]

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Definition at line 45 of file txtfilter.py.

Reimplemented from wicked.fieldevent.txtfilter.TxtFilter.

Reimplemented in wicked.txtfilter.BrackettedWickedFilter.

Definition at line 54 of file txtfilter.py.

Definition at line 48 of file txtfilter.py.

Definition at line 53 of file txtfilter.py.


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