Changeset 1380 in products


Ignore:
Timestamp:
Nov 17, 2009 7:08:08 AM (14 years ago)
Author:
piv
Message:

add section to flush zope database cache

Location:
quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier/configure.zcml

    r732 r1380  
    129129        /> 
    130130 
     131    <utility 
     132        component=".flushcache.FlushCacheSection" 
     133        name="quintagroup.transmogrifier.flushcache" 
     134        provides="collective.transmogrifier.interfaces.ISectionBlueprint" 
     135        /> 
     136 
    131137    <transmogrifier:registerConfig 
    132138        name="export" 
  • quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier/tests.py

    r710 r1380  
    941941    test.globs['transmogrifier'].context = test.globs['plone'] 
    942942 
     943def flushCacheSetUp(test): 
     944    sectionsSetUp(test) 
     945     
     946    class DataBase(object): 
     947        def __init__(self, context): 
     948            self.context = context 
     949         
     950        def cacheMinimize(self): 
     951            self.context.cacheMinimized += 1 
     952 
     953        def _getDB(self): 
     954            return self 
     955     
     956    class DataBasePanel(object): 
     957        def __init__(self, context): 
     958            self.context = context 
     959         
     960        def getDatabaseNames(self): 
     961            return ('main',) 
     962         
     963        def __getitem__(self, key): 
     964            return DataBase(self.context) 
     965     
     966    class ControlPanel(object): 
     967        def __init__(self, context): 
     968            self.Database = DataBasePanel(context) 
     969     
     970    class MockPortal(object): 
     971        def __init__(self): 
     972            self.cacheMinimized = 0 
     973            self.Control_Panel = ControlPanel(self) 
     974         
     975    test.globs['plone'] = MockPortal() 
     976    test.globs['transmogrifier'].context = test.globs['plone'] 
     977 
    943978def test_suite(): 
    944979    import sys 
     
    9811016            'catalogsource.txt', 
    9821017            setUp=catalogSourceSetUp, tearDown=tearDown), 
     1018        doctest.DocFileSuite( 
     1019            'flushcache.txt', 
     1020            setUp=flushCacheSetUp, tearDown=tearDown), 
    9831021    )) 
    9841022    return suite 
Note: See TracChangeset for help on using the changeset viewer.