[Zapp-cvs-commit] ZApp ZApp_Application.py,1.21,1.22 ZApp_CMFBase.py,1.11,1.12 ZApp_MiscData.py,1.16
Brought to you by:
sspickle
|
From: <ssp...@us...> - 2003-08-07 13:50:35
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv14418
Modified Files:
ZApp_Application.py ZApp_CMFBase.py ZApp_MiscData.py
Log Message:
improve CMF base class so support copy/paste/delete with miscdata triggers
Index: ZApp_Application.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Application.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** ZApp_Application.py 3 Jul 2003 22:30:02 -0000 1.21
--- ZApp_Application.py 7 Aug 2003 13:50:32 -0000 1.22
***************
*** 184,188 ****
for leverSet in leverSetList:
! for itemID in leverSet.objectIds():
uniq[ itemID ] = 1
--- 184,188 ----
for leverSet in leverSetList:
! for itemID in leverSet.objectIds('Script (Python)'):
uniq[ itemID ] = 1
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ZApp_CMFBase.py 3 Jul 2003 22:30:02 -0000 1.11
--- ZApp_CMFBase.py 7 Aug 2003 13:50:32 -0000 1.12
***************
*** 6,10 ****
import time
import string
! from ZApp_Base import ZApp_Base, extendProperties
#
--- 6,18 ----
import time
import string
! from ZApp_Base import ZApp_Base, extendProperties, LeverPropertyCollection, LeverProperty
!
! lpcol = LeverPropertyCollection
! lprop = LeverProperty
!
! props = lpcol(
! [lprop(id='portal_type'),
! ]
! )
#
***************
*** 21,24 ****
--- 29,34 ----
from DateTime import DateTime
+ import tempfile
+
class ZApp_CMFBase(FreeRangeDS, ZApp_Base, PortalContent, DefaultDublinCoreImpl, ZApp_MiscDataUser):
***************
*** 33,36 ****
--- 43,52 ----
manage_options = PortalContent.manage_options
+ def getMiscDataManager(self):
+ """find the id of the specialist for this class.. """
+ dm = self.getDataManagerFor( self, None )
+ Manager = dm.aq_parent.id
+ return Manager
+
# Declarative security (replaces __ac_permissions__)
***************
*** 61,65 ****
return "OK!"
! extendProperties(ZApp_CMFBase, [])
def addZAppCMFObject(self, id, title='', klass=ZApp_CMFBase, useExisting=1):
--- 77,117 ----
return "OK!"
! def _notifyOfCopyTo(self, container, op=0):
! """we use _notifyOfCopy to save our miscData to a volitile container property
! so that the copy can retrieve it once created..."""
!
! #ti = self.getTypeInfo to handle media item copy/paste... notify
! #actions = ti.listActions()
! #for action in actions:
! #if action.getId() ==
! copyID = '_v_' + self.id + 'copyXML'
! setattr(container, copyID, self.safeMiscData.getXMLDict())
!
! def manage_afterAdd(self, item, container):
! """ restore XML from volitile attribute.. """
!
! PortalContent.manage_afterAdd(self, item, container)
!
! checkID = self.id
!
! if checkID[:4] == 'copy':
! pos = checkID.find('_of_')
! if pos>3:
! if pos>4:
! try:
! x = int(checkID[4:pos])
! checkID = checkID[pos + 4:]
! except ValueError:
! pass
! else:
! checkID = checkID[pos + 4:]
!
! copyID = '_v_' + checkID + 'copyXML'
! savedXML = getattr(container, copyID, {})
!
! if savedXML:
! self.safeMiscData.setXMLAttrs( dict = savedXML )
!
! extendProperties(ZApp_CMFBase, props)
def addZAppCMFObject(self, id, title='', klass=ZApp_CMFBase, useExisting=1):
***************
*** 185,186 ****
--- 237,240 ----
},
)
+
+
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ZApp_MiscData.py 6 Aug 2003 05:36:48 -0000 1.16
--- ZApp_MiscData.py 7 Aug 2003 13:50:32 -0000 1.17
***************
*** 22,26 ****
props = lpcol(
[lprop(id='Manager'),
! lprop(id='objectID'),
lprop(id='dataType', dbSize=100),
lprop(id='xml', prop_type='text', dbType='text'),
--- 22,26 ----
props = lpcol(
[lprop(id='Manager'),
! lprop(id='objectID', dbSize=1023),
lprop(id='dataType', dbSize=100),
lprop(id='xml', prop_type='text', dbType='text'),
***************
*** 141,144 ****
--- 141,145 ----
"WITH SELF COMPUTE miscDataManager = self.getMiscDataManager()",
"WITH SELF COMPUTE safeMiscData=self.miscData or self.setupMiscData()",
+ "WHEN OBJECT DELETED CALL self.miscData and self.miscData.manage_delete()",
)
***************
*** 190,194 ****
if mdm is missing:
mds = self.getMiscDataSpecialist()
! for aBag in mds.ZApp_getItems( objectID = self.id, Manager = Manager):
if aBag.dataType == dataType:
mdm = aBag
--- 191,195 ----
if mdm is missing:
mds = self.getMiscDataSpecialist()
! for aBag in mds.ZApp_getItems( objectID = self.getMiscObjectID(), Manager = Manager):
if aBag.dataType == dataType:
mdm = aBag
***************
*** 213,220 ****
localmdmKey = Manager + ":" + dataType
md = self.getMiscDataSpecialist()
! mdm = md.ZApp_createNewItem( objectID = self.id, Manager = Manager, dataType=dataType )
self._v_MyMDMCache[localmdmKey] = mdm
return mdm
def getDataPropertyManagers(self, withID=''):
--- 214,229 ----
localmdmKey = Manager + ":" + dataType
md = self.getMiscDataSpecialist()
! mdm = md.ZApp_createNewItem( objectID = self.getMiscObjectID(), Manager = Manager, dataType=dataType )
self._v_MyMDMCache[localmdmKey] = mdm
return mdm
+
+ def getMiscObjectID(self):
+ """ compute object for MiscData.. """
+ if getattr(self, '_primaryKeyGenerator',None):
+ result = eval(self._primaryKeyGenerator)
+ else:
+ result = self.id
+ return result
def getDataPropertyManagers(self, withID=''):
|