Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface, Attribute, implements
00002 from wicked.fieldevent.interfaces import ITxtFilter, IFieldEvent
00003 from wicked.fieldevent.interfaces import IFieldStorageEvent
00004 from zope.annotation.interfaces import IAnnotatable
00005 
00006 class IUID(Interface):
00007     """an effectively unique identifier for the context of the system"""
00008 
00009 
00010 class IWickedFilter(ITxtFilter):
00011     """
00012     Wicked txtfilter
00013 
00014     @@ fill out interface for subscription adapter
00015     """
00016 
00017 
00018 class IAmWickedField(Interface):
00019     """
00020     A 'field' specifically designated for wicked behavior.  Could be
00021     just a wrapper for a getter and a setter combo.
00022 
00023     @@ will probably initially have some at cruft to it
00024     """
00025 
00026 
00027 class IAmWicked(IAnnotatable):
00028     """
00029     wicked content... marker to indicate a piece of content has wicked
00030     fields
00031     """
00032 
00033 
00034 class IWickedTarget(Interface):
00035     """
00036     marker interface for an object linked to in a wicked text area
00037     """
00038 
00039 
00040 class IWickedBacklink(Interface):
00041     """
00042     Backlink marker
00043 
00044     @@ is this used?
00045     """
00046 
00047     
00048 class IWickedFilter(Interface):
00049     """
00050     Wicked resolving filter
00051     """
00052     ### this need complete documentation and test to verify
00053 
00054 
00055 class IBacklinkManager(Interface):
00056     """
00057     this might become the wicked storage manager...
00058     """
00059     def manageLinks():
00060         """
00061         removes old links adds new
00062         """
00063 
00064     def addLinks(links, scope, dups=[]):
00065         """
00066         retrieves brains, and sets backlinks for a colletion
00067         wicked links.  will filter against identifiers(UIDs)
00068         in dups (this allow chaining with removelinks, which
00069         returns duplicate links)
00070         """
00071         
00072     def getLinks():
00073         """
00074         returns all current backlinks
00075         """
00076         
00077     def set(brain, link):
00078         """
00079         creates a backlink(a smart pointer pointing for the links target)
00080         and caches link
00081         """
00082         
00083     def remove(brain):
00084         """
00085         does the actual backlink removal and cache unsetting
00086         """
00087 
00088     def removeLinks(exclude=tuple()):
00089         """
00090         iterates over a list of brain representing existing backlink
00091         and executes backlink deletion if not included in exclude
00092         
00093         @exclude: list of strings 'links' not to erase
00094         """
00095 
00096 class IATBacklinkManager(IBacklinkManager):
00097     """
00098     A manager for Archetypes reference (aka smart pointer) based backlinka 
00099     """
00100     relation = Attribute( """
00101     Name of Archetype relationship. Used to retrieve
00102     backlinks from reference engine
00103     """)
00104 
00105 
00106 class ICacheManager(Interface):
00107     """
00108     a cache manager that cache per content instance
00109     on the content type itself. It manages a dual level data
00110     structure: dict(section=dict(key=value))
00111     """
00112     cache_attr = Attribute('attribute to access cache through')
00113     section = Attribute('attribute to access sub-cache through')
00114     cache=Attribute('Actually persisted cache object')
00115 
00116     def __init__(field, context):
00117         """
00118         cache manager multiadapts the field and the context
00119         """
00120 
00121     def get(key, default, **kwargs):
00122         """
00123         @rendered wicked link
00124         """
00125         
00126     def set(key, text):
00127         """
00128         sets text to cache
00129         """
00130         
00131     def unset(key):
00132         """
00133         invalidates cache key
00134         """
00135 
00136     def _get_store():
00137         """
00138         create and / or
00139         @return the  master store
00140         """
00141         
00142     def _get_cache():
00143         """
00144         @return actual datastructure
00145         for getting and setting
00146         """
00147         
00148 class IWickedQuery(Interface):
00149     """
00150     object for handling and returning
00151     dataobjects for wicked prep
00152     for the macro parser
00153     """
00154     
00155     chunk = Attribute('unaltered string from inside ((wicked link))')
00156     normalized = Attribute('normalled chunk')
00157     scope = Attribute('scoping parameter for "scoped" searches')
00158 
00159     def scopedSearch(best_match):
00160         """
00161         @param best_match : attempt to make
00162         best match for query returned
00163 
00164         @return: list of dataobjects
00165         """
00166         
00167     def search(chunk, normalized, best_match):
00168         """
00169         @param best_match : attempt to make
00170         best match for query returned
00171 
00172         @return : list of dataobjects
00173         """
00174         
00175     def configure(chunk, normalized, scope):
00176         """
00177         configure set instance attributes
00178         
00179         @param chunk : instance attr 
00180         @param normalized : instance attr
00181         @param scope : instance attr
00182 
00183         @return : None
00184         """
00185         
00186 class IWickedLink(Interface):
00187     """renderer for wicked links"""
00188 
00189     def context():
00190         """
00191         context
00192         """
00193         
00194     def howmany():
00195         """
00196         @return integer
00197         how many links
00198         """
00199         
00200     def multiple():
00201         """
00202         @return boolean
00203         howmany > 1
00204         """
00205 
00206     def links():
00207         """
00208         @return list
00209         list of link datum
00210         """
00211 
00212     def singlelink():
00213         """
00214         @return boolean
00215         howmany == 1
00216         """
00217 
00218     def load(links, chunk, section):
00219         """
00220         load data for repeated rendering
00221         """
00222 
00223 
00224 class IWickedEvent(Interface):
00225     """something wicked is happening"""
00226 
00227 
00228 class IValueToString(Interface):
00229     """converts a field object to a raw string. mainly used to get
00230     around AT's un normalized value handling"""
00231 
00232 
00233 class IScope(Interface):
00234     """a value used to determine breadth of resolver's search. usually a path"""
00235 
00236 
00237 class WickedEvent(object):
00238     implements(IWickedEvent)
00239 
00240 class IWickedContentAddedEvent(Interface):
00241     """a piece of content is add by wicked"""
00242     title = Attribute("title of new content")
00243     section = Attribute("subobject of concern")
00244     request = Attribute("current request")
00245     section = Attribute("field name inside context")
00246     context = Attribute("context linked from")
00247     newcontent = Attribute("object representing new content")
00248 
00249 class WickedContentAddedEvent(WickedEvent):
00250     implements(IWickedContentAddedEvent)
00251     
00252     def __init__(self, context, newcontent, title, section, request=None):
00253         self.__dict__.update(locals())