Back to index

plone3  3.1.7
cache.py
Go to the documentation of this file.
00001 ##########################################################
00002 #
00003 # Licensed under the terms of the GNU Public License
00004 # (see docs/LICENSE.GPL)
00005 #
00006 # Copyright (c) 2005:
00007 #   - The Open Planning Project (http://www.openplans.org/)
00008 #   - Whit Morriss <whit at www.openplans.org>
00009 #   - and contributors
00010 #
00011 ##########################################################
00012 from zope.interface import implements, Interface
00013 from general import dummy
00014 
00015 class Filter(object):
00016     """
00017     dummy
00018     """
00019     implements(Interface)
00020     
00021     def __init__(self, context):
00022         self.context = context
00023 
00024     def _filterCore(self, *args, **kwargs):
00025         pass
00026 
00027     def filter(self, *args, **kwargs):
00028         pass
00029     
00030     section='body'
00031 
00032 portal_tools = dict()
00033 def getToolByName(context, toolname, default):
00034     return portal_tools.get(toolname, default)
00035 
00036 def backlinkTools():
00037     import Products.CMFCore.utils
00038     Products.CMFCore.utils.getToolByName = getToolByName
00039     from Products import AdvancedQuery
00040     from Products.CMFCore.CatalogTool import CatalogTool
00041     from Products.Archetypes.ReferenceEngine import ReferenceCatalog, UIDCatalog
00042     return dict(portal_workflow=None,
00043                 portal_catalog=CatalogTool(),
00044                 reference_catalog=ReferenceCatalog(id='portal_reference'),
00045                 portal_uid=UIDCatalog(id='portal_uid'))
00046 
00047 def setupTools(tools):
00048     portal_tools.update(tools)
00049 
00050 from general import pdo
00051 
00052 ## class pRefCat(dict):
00053 ##     def _queryFor(self, **kw):
00054 ##         self.get(kw['tid']) 
00055 
00056 ##     def addReference(self, obj, target, *args, **kwargs):
00057 ##         attrs= dict(targetUID=target.UID())
00058 
00059 ##         if not self.has_key(self[obj.UID()]):
00060 ##             self[obj.UID()] = []
00061             
00062 ##         self[obj.UID()].append(pdo(attrs))
00063 
00064 ##     def _resolveBrains(self, suid, tuid, *args):
00065 ##         return [x for x in self.get(suid) if x.targetUID==tuid].pop()
00066     
00067 ##    def _deleteReference(self, obj):
00068 ##         del self[obj.UID()]