[Zapp-cvs-commit] ZApp/tests/SimpleReplicator README.txt,NONE,1.1 SRep_Replicator.py,NONE,1.1 __init
Brought to you by:
sspickle
|
From: <ssp...@us...> - 2004-02-05 22:04:21
|
Update of /cvsroot/zapp/ZApp/tests/SimpleReplicator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13191/tests/SimpleReplicator Added Files: README.txt SRep_Replicator.py __init__.py Log Message: added replication example.. --- NEW FILE: README.txt --- SimpleReplicator is a dumb class you can use to test replication. You can put the following skinscript in your CMFData specialists defaultRack: WHEN OBJECT CHANGED CALL self.Replications.handleReplicationUpdate( self ) WHEN OBJECT DELETED CALL self.Replications.handleReplicationDelete( self.cmfdataid ) Then the following python methods in the Replications specialist: ## Script (Python) "handleReplicationDelete" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=otherID ##title= ## theRep = container.getItem( otherID ) if theRep: theRep.manage_delete() ## Script (Python) "handleReplicationUpdate" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=otherObject ##title= ## theRep = container.getItem( otherObject.cmfdataid ) if not theRep: theRep = container.newItem( otherObject.cmfdataid ) md = otherObject.safeMiscData.getXMLDict() fd = md.get('foo',{}) theRep.change( bar=fd.get('bar',''), baz=fd.get('baz')) --- NEW FILE: SRep_Replicator.py --- # # Use ZApp_Base as a base class to make details easier.. template for SRep_Replicator # from Products.ZApp import ZApp_Base from Products.PageTemplates.PageTemplateFile import PageTemplateFile lpcol = ZApp_Base.LeverPropertyCollection lprop = ZApp_Base.LeverProperty props = lpcol([ lprop(id='bar'), lprop(id='baz'), ] ) class SRep_Replicator( ZApp_Base.ZApp_Base ): meta_type = 'SRep Replicator' ZApp_Base.extendProperties( SRep_Replicator, props ) def initialize(context): context.registerBaseClass(SRep_Replicator) --- NEW FILE: __init__.py --- # # SimpleReplicator Product init module.. # if 0: from Products.CMFCore import utils from Products.CMFCore.DirectoryView import registerDirectory from Products.CMFCore.PortalFolder import PortalFolder from Products.CMFCore import CMFCorePermissions import SRep_Replicator def initialize(context, debug=None): SRep_Replicator.initialize( context ) |