[Zapp-cvs-commit] ZApp ZApp_Application.py,1.25,1.26 ZApp_Base.py,1.20,1.21 ZApp_CMFBase.py,1.16,1.1
Brought to you by:
sspickle
|
From: <ssp...@us...> - 2003-10-28 20:29:46
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv28855
Modified Files:
ZApp_Application.py ZApp_Base.py ZApp_CMFBase.py ZApp_LOG.py
ZApp_MiscData.py ZApp_RelatableItem.py
ZApp_RelationshipItem.py ZApp_RelationshipManager.py
ZApp_Specialist.py
Log Message:
attempt to merge new CMF relations back to main branch
Index: ZApp_Application.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Application.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ZApp_Application.py 12 Sep 2003 15:27:50 -0000 1.25
--- ZApp_Application.py 28 Oct 2003 20:27:03 -0000 1.26
***************
*** 87,90 ****
--- 87,91 ----
index_html.plain
quickDisplay_html.plain
+ filterDisplay_html.plain
updateItem.plain
updateItem_html.plain """
***************
*** 128,131 ****
--- 129,133 ----
applicationMetaType = meta_type = 'Z App Application'
specialistMetaTypes = ['Specialist','Z App Specialist']
+
LOCALE_ID = 'TST'
***************
*** 273,277 ****
SDT = 'SESSION_DATA_TYPE'
!
def getUserSessions(self, browserID=None, create=0):
"""
--- 275,279 ----
SDT = 'SESSION_DATA_TYPE'
!
def getUserSessions(self, browserID=None, create=0):
"""
Index: ZApp_Base.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Base.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** ZApp_Base.py 25 Jun 2003 15:47:30 -0000 1.20
--- ZApp_Base.py 28 Oct 2003 20:27:03 -0000 1.21
***************
*** 8,12 ****
import os
! ZAPP_DEBUG=os.environ.get('ZAPP_DEBUG',0)
from OFS import SimpleItem
--- 8,13 ----
import os
! undefined_zdb = []
! ZAPP_DEBUG=os.environ.get('ZAPP_DEBUG',undefined_zdb)
from OFS import SimpleItem
***************
*** 46,49 ****
--- 47,52 ----
DataSkin.__get_attr__ = __new__get_attr__
+ if ZAPP_DEBUG is not undefined_zdb:
+
__orig__notify = Trigger._notify
***************
*** 62,65 ****
--- 65,70 ----
Trigger._notify = __new__notify
+ if ZAPP_DEBUG:
+
__orig__AttributeFor = Compute._AttributeFor
***************
*** 168,172 ****
return primary key of self..
"""
! return self.aq_parent.defaultRack.loadAttrib or 'pk'
def applicationURL(self):
--- 173,180 ----
return primary key of self..
"""
! return self._v_dm_.defaultRack.loadAttrib or 'pk'
!
! def getPrimaryKeyValue(self):
! return self.id
def applicationURL(self):
***************
*** 197,204 ****
def beforeChange(self):
pass
def afterChange(self):
try:
! crr = self.aq_parent.ZApp_clearResultCache
except AttributeError:
crr = None
--- 205,216 ----
def beforeChange(self):
pass
+
+ def getMySpecialist(self):
+ """ get my specialist """
+ return self._v_dm_.aq_inner.aq_parent
def afterChange(self):
try:
! crr = self.getMySpecialist().ZApp_clearResultCache
except AttributeError:
crr = None
***************
*** 214,219 ****
argDict = self.get_argument_dictionary( props, REQUEST, kw)
! ZApp_LOG("changing " + self.aq_parent.id + ":" + self.id + ":" + `argDict`)
!
self.beforeChange()
self.manage_changeProperties(argDict)
--- 226,231 ----
argDict = self.get_argument_dictionary( props, REQUEST, kw)
! ZApp_LOG("changing " + self.getMySpecialist().getId() + ":" + self.id + ":" + `argDict`)
!
self.beforeChange()
self.manage_changeProperties(argDict)
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ZApp_CMFBase.py 11 Sep 2003 09:47:03 -0000 1.16
--- ZApp_CMFBase.py 28 Oct 2003 20:27:03 -0000 1.17
***************
*** 8,17 ****
from ZApp_Base import ZApp_Base, extendProperties, LeverPropertyCollection, LeverProperty
lpcol = LeverPropertyCollection
lprop = LeverProperty
props = lpcol(
! [lprop(id='cmf_portal_type'),
! ]
)
--- 8,23 ----
from ZApp_Base import ZApp_Base, extendProperties, LeverPropertyCollection, LeverProperty
+ from ZApp_LOG import ZApp_LOG
+
+ missing = []
+
lpcol = LeverPropertyCollection
lprop = LeverProperty
props = lpcol(
! [
! lprop(id='cmf_portal_type'),
! lprop(id='safeStorageID'),
! ]
)
***************
*** 20,25 ****
#
- from Products.CMFCore.PortalContent import PortalContent
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
from AccessControl import ClassSecurityInfo, getSecurityManager
from Products.CMFCore import CMFCorePermissions
--- 26,31 ----
#
from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
+ from Products.CMFDefault.SkinnedFolder import SkinnedFolder
from AccessControl import ClassSecurityInfo, getSecurityManager
from Products.CMFCore import CMFCorePermissions
***************
*** 27,30 ****
--- 33,38 ----
from ZApp_RelatableItem import ZApp_RelatedObject
from Products.FreeRangeDS import FreeRangeDS, _v_dm_
+ from OFS.CopySupport import CopySource
+ from Acquisition import ImplicitAcquisitionWrapper,aq_base
from DateTime import DateTime
***************
*** 32,68 ****
import tempfile
! class ZApp_CMFBase(FreeRangeDS, ZApp_Base, PortalContent, DefaultDublinCoreImpl, ZApp_MiscDataUser, ZApp_RelatedObject):
! meta_type = 'ZApp CMF Content Type'
zapp_cmf_type = 1
! _primaryKeyStringSize=255 # allow for a pretty rediculous size...
!
! __implements__ = ( PortalContent.__implements__
! , DefaultDublinCoreImpl.__implements__
! )
!
! 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__)
_primaryKeyGenerator='self.calcPathID()'
_insertQueryPrefix = 'self.checkDups() and '
def checkDups(self):
! return not self.__dict__[_v_dm_].getItem(self.calcPathID())
def calcPathID(self):
! if self.id.find(',') != -1:
! result = self.id
! else:
! objPath = ','.join(self.getPhysicalPath())
! portalPath = ','.join(self.portal_url.getPortalObject().getPhysicalPath()) + ','
! result = objPath[len(portalPath)-1:]
return result
--- 40,85 ----
import tempfile
! class ZApp_CMFBase(FreeRangeDS, SkinnedFolder, ZApp_Base, DefaultDublinCoreImpl, ZApp_MiscDataUser, ZApp_RelatedObject):
! meta_type = 'ZApp CMF Content'
zapp_cmf_type = 1
! isPrincipiaFolderish = 1
! class_default_for_copyable = 0 # make these guys default to 'not copyable'
+ _primaryKeyStringSize=255 # allow for a pretty rediculous size...
_primaryKeyGenerator='self.calcPathID()'
_insertQueryPrefix = 'self.checkDups() and '
+ manage_options = SkinnedFolder.manage_options
+
+ def getPrimaryKeyValue(self):
+ return self.calcPathID()
+
def checkDups(self):
! """
! Check for a pre-existing record.... don't rely on data cached in 'self'
! since we could be in a copy/cut/paste operation.
! """
!
! dupID = self.calcPathID()
! spec = self.getMySpecialist()
! pk = spec.getPrimaryKey()
! dup = spec.ZApp_doSelectItem( REQUEST={ pk: dupID })
! result = not dup
! return result
def calcPathID(self):
!
! try:
! if self.id.find(',') != -1:
! result = self.id
! else:
! objPath = ','.join(self.getPhysicalPath())
! portalPath = ','.join(self.portal_url.getPortalObject().getPhysicalPath()) + ','
! result = objPath[len(portalPath)-1:]
! except:
! raise
!
return result
***************
*** 77,132 ****
return "OK!"
def _setId(self, id):
! # check for rename operation..
! currID = self.__dict__.get('id',None)
! print "in _setID of CMFBase..."
! if currID is not None:
! self.__dict__['_v_ZApp_OrigID'] = currID
! print "currID was not none... but " + currID
else:
! print "currID was None."
! return ZApp_Base._setId(self, id)
!
! 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() ==
! print "in notify copy.. "
! copyID = '_v_' + self.id + 'copyXML'
! setattr(container, copyID, self.safeMiscData.getXMLDict())
def manage_afterAdd(self, item, container):
! """ restore XML from volitile attribute.. """
!
! #print "in manage_afterAdd", self.id
! PortalContent.manage_afterAdd(self, item, container)
ZApp_Base.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)
--- 94,226 ----
return "OK!"
+
+ def _canCopy(self, op=0):
+ """
+ Can this object be copied?
+ """
+ return getattr(self, 'copyable',0)
+
+ def _notifyOfCopyTo(self, container, op=0):
+ """we use _notifyOfCopy to save our miscData to a property
+ so that the copy can retrieve it once created..."""
+
+ mdm = self.getMiscDataSpecialist()
+ safeStorage = mdm.ZApp_createNewItem(objectID=self.calcPathID(), dataType='copyPasteStorage', Manager=self.safeMiscData.Manager)
+ if safeStorage:
+ safeStorage.setXMLAttrs( operationType = op )
+ safeStorage.setXMLAttrs( oldID = self.calcPathID())
+ safeStorageID = safeStorage.getId()
+ self.change(safeStorageID = safeStorageID )
+ get_transaction().commit(1)
+
+ ZApp_LOG("_notifyOfCopyTo: Setting safeStorageID to " + safeStorageID)
def _setId(self, id):
! #
! # save the 'safeStorageID' so we can use it when we're added again..
! #
! oldID = self.getId()
!
! if oldID:
! safeStorageID = getattr(self, 'safeStorageID','')
! cmf_portal_type = getattr(self, 'cmf_portal_type','')
! result = ZApp_Base._setId(self, id)
!
! if oldID:
! self._v_safeStorageID = safeStorageID
! self._v_cmf_portal_type = cmf_portal_type
else:
! self._v_safeStorageID = None
! self._v_cmf_portal_type = None
! ZApp_LOG("_setID: SafeStorageID, cmf_portal_type are now %s" % (`(self._v_safeStorageID,oldID,id,self._v_cmf_portal_type)`))
!
! return result
!
! def _getCopy(self, container):
! ZApp_LOG("_getCopy, before" + `self.__dict__`)
!
! safeStorageID = self.safeStorageID
! self = aq_base(self).__of__(container)
! ob = CopySource._getCopy.im_func(self,container)
! ob.__of__(container) # force DM hookup
! if safeStorageID:
! ob.__dict__['safeStorageID'] = safeStorageID
! ob.__dict__['cmf_portal_type'] = self.portal_type
! ZApp_LOG("_getCopy, after" + `ob.__dict__`)
+ return ob
+
def manage_afterAdd(self, item, container):
! """ restore XML from volitile attribute..
!
! at this point 'self' is somewhat bogus. It still has cached DataSkin attributes from its prior self.
!
! """
!
! ZApp_LOG("_manage_afterAdd" + `self.__dict__`)
!
! safeStorageID = getattr(self, '_v_safeStorageID','')
! cmf_portal_type = getattr(self, '_v_cmf_portal_type','')
!
! SkinnedFolder.manage_afterAdd(self, item, container)
ZApp_Base.manage_afterAdd(self, item, container)
! if safeStorageID:
! mdm = self.getMiscDataSpecialist()
! safeStorage = mdm.getItem(safeStorageID)
! if safeStorage:
! get = safeStorage.getXMLAttr
! op = get('operationType','')
! oldID = get('oldID','')
! mySpec = self.getMySpecialist()
!
! if mySpec and oldID:
! oldSelf = mySpec.getItem( oldID )
!
! if oldSelf:
! newSelf = mySpec.ZApp_createNewItem(id=self.calcPathID())
! mySpec.commit_subtransaction()
! newSelf.setMiscData( dataDict = oldSelf.safeMiscData.getXMLDict())
! newSelf.change(safeStorageID = '', cmf_portal_type=cmf_portal_type)
! mySpec.commit_subtransaction()
!
! newSelf.copyObjectRelations( oldSelf.objectRelations( returnObjects=1 ))
!
! if op:
! #
! # it's a move operation...
! #
! oldSelf.manage_delete()
! else:
! oldSelf.change(safeStorageID = '')
!
! safeStorage.manage_delete()
!
! if self.safeStorageID:
! self.change(safeStorageID = '')
!
! if hasattr(self, '_v_safeStorageID'):
! del self._v_safeStorageID # we've got it now.. thanks. ;-)
!
!
! def copyObjectRelations(self, theObjectRelations):
! """
! copy object relations that belong to the object I was cloned from...
! """
! for relationDict in theObjectRelations:
! get = relationDict.get
! otherObject = get('otherObject','')
! otherRole = get('otherRole','')
! contextID = get('otherContextID','')
! selfContextID = get('selfContextID','')
!
! selfRole = get('selfRole','')
! if otherObject:
! selfRItem = self.addObject( otherObject, otherRole, selfRole, contextID)
! selfRItem.change(contextID=selfContextID)
extendProperties(ZApp_CMFBase, props)
***************
*** 139,153 ****
existingObject = None
!
if id.find(',') != -1:
raise RuntimeError, "Sorry.. no ',' allowed in id!"
!
if useExisting:
dm = self.getDataManagerFor( klass, None )
if dm != None:
objPath = ','.join(self.getPhysicalPath()) + ',' + id
portalPath = ','.join(self.portal_url.getPortalObject().getPhysicalPath()) + ','
checkID = objPath[len(portalPath):]
! existingObject = dm.getItem( checkID )
if existingObject:
--- 233,248 ----
existingObject = None
!
if id.find(',') != -1:
raise RuntimeError, "Sorry.. no ',' allowed in id!"
!
if useExisting:
dm = self.getDataManagerFor( klass, None )
+
if dm != None:
objPath = ','.join(self.getPhysicalPath()) + ',' + id
portalPath = ','.join(self.portal_url.getPortalObject().getPhysicalPath()) + ','
checkID = objPath[len(portalPath):]
! existingObject = dm.getItem(checkID)
if existingObject:
***************
*** 251,254 ****
--- 346,357 ----
, 'action': 'string:${object_url}/metadata_edit_form'
, 'permissions' : (CMFCorePermissions.ModifyPortalContent,)},
+ { 'id' : 'subobjects'
+ , 'name' : 'SubObjects'
+ , 'action': 'string:${object_url}/zapp_cmf_sub_contents'
+ , 'permissions' : (CMFCorePermissions.View,)},
+ { 'id' : 'test'
+ , 'name' : 'Test'
+ , 'action': 'string:${object_url}/zapp_cmf_object_test'
+ , 'permissions' : (CMFCorePermissions.ManagePortal,)},
),
},
Index: ZApp_LOG.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_LOG.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ZApp_LOG.py 30 Mar 2003 16:25:02 -0000 1.3
--- ZApp_LOG.py 28 Oct 2003 20:27:03 -0000 1.4
***************
*** 3,7 ****
from zLOG import register_subsystem, LOG, INFO
! ZAPP_DEBUG=os.environ.get('ZAPP_DEBUG',0)
ZAPP_DEBUG_BREAK=os.environ.get('ZAPP_DEBUG_BREAK',0)
--- 3,7 ----
from zLOG import register_subsystem, LOG, INFO
! ZAPP_DEBUG=os.environ.get('ZAPP_DEBUG',None) is not None
ZAPP_DEBUG_BREAK=os.environ.get('ZAPP_DEBUG_BREAK',0)
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** ZApp_MiscData.py 23 Sep 2003 18:51:44 -0000 1.20
--- ZApp_MiscData.py 28 Oct 2003 20:27:03 -0000 1.21
***************
*** 24,28 ****
props = lpcol(
[lprop(id='Manager'),
! lprop(id='objectID', dbSize=1023),
lprop(id='dataType', dbSize=100),
lprop(id='xml', prop_type='text', dbType='text'),
--- 24,28 ----
props = lpcol(
[lprop(id='Manager'),
! lprop(id='objectID', dbSize=255),
lprop(id='dataType', dbSize=100),
lprop(id='xml', prop_type='text', dbType='text'),
***************
*** 171,175 ****
Manager = self.miscDataManagerKey
else:
! Manager = self.aq_inner.aq_parent.id
return Manager
--- 171,175 ----
Manager = self.miscDataManagerKey
else:
! Manager = self.getMySpecialist().getId()
return Manager
***************
*** 191,195 ****
"""
! Manager = Manager or self.miscDataManager
localmdmKey = Manager + ":" + dataType
mdm = self._v_MyMDMCache.get(localmdmKey, missing)
--- 191,195 ----
"""
! Manager = (Manager or '') or self.miscDataManager
localmdmKey = Manager + ":" + dataType
mdm = self._v_MyMDMCache.get(localmdmKey, missing)
***************
*** 239,243 ****
result = []
! myDM = self.__dict__[_v_dm_]
for provider in getattr(myDM,myDM.DataPlugins.attr):
if provider.meta_type == 'DataSkin Class Extender':
--- 239,243 ----
result = []
! myDM = self._v_dm_
for provider in getattr(myDM,myDM.DataPlugins.attr):
if provider.meta_type == 'DataSkin Class Extender':
***************
*** 496,500 ****
"""
result = ZApp_MiscDataAttributeProvider.inheritedAttribute('manage_editProperties')(self, REQUEST)
! myDM = self.aq_parent
propManAttr = 'PropSheetFor_' + self.propsheetname
for provider in getattr(myDM,myDM.DataPlugins.attr):
--- 496,500 ----
"""
result = ZApp_MiscDataAttributeProvider.inheritedAttribute('manage_editProperties')(self, REQUEST)
! myDM = self._v_dm_
propManAttr = 'PropSheetFor_' + self.propsheetname
for provider in getattr(myDM,myDM.DataPlugins.attr):
Index: ZApp_RelatableItem.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelatableItem.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** ZApp_RelatableItem.py 12 Sep 2003 15:27:50 -0000 1.20
--- ZApp_RelatableItem.py 28 Oct 2003 20:27:03 -0000 1.21
***************
*** 5,12 ****
--- 5,14 ----
import ZApp_Base
import string
+
lpcol = ZApp_Base.LeverPropertyCollection
lprop = ZApp_Base.LeverProperty
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+ from ZApp_LOG import ZApp_LOG
class ZApp_RelatableParentMixin:
***************
*** 23,27 ****
if not parentManager:
! parentManager = self.aq_parent.id
conditions={ referenceAttribute:self.id, 'parentManager':parentManager }
--- 25,29 ----
if not parentManager:
! parentManager = self.getMySpecialist().getId()
conditions={ referenceAttribute:self.id, 'parentManager':parentManager }
***************
*** 78,82 ****
if not parentManager:
! parentManager = self.aq_parent.id
conditions={ 'parentID':self.id, 'parentManager':parentManager, 'countMinMax':'contextID::text::int' } # this is PG specific!
--- 80,84 ----
if not parentManager:
! parentManager = self.getMySpecialist().getId()
conditions={ 'parentID':self.id, 'parentManager':parentManager, 'countMinMax':'contextID::text::int' } # this is PG specific!
***************
*** 117,128 ****
contextID = self.nextContextID()
! return {'parentID':self.id, 'parentManager':self.aq_parent.id, 'contextID':contextID}
def getObjectManager(self, objectManagerID=None):
if objectManagerID:
! om = getattr(self.aq_parent, objectManagerID)
else:
! om = (self.childManagers and getattr(self.aq_parent, self.childManagers[0])) or self.aq_parent
return om
--- 119,131 ----
contextID = self.nextContextID()
! return {'parentID':self.id, 'parentManager':self.getMySpecialist().getId(), 'contextID':contextID}
def getObjectManager(self, objectManagerID=None):
if objectManagerID:
! om = getattr(self.getMySpecialist(), objectManagerID)
else:
! mySpec = self.getMySpecialist()
! om = (self.childManagers and getattr(mySpec, self.childManagers[0])) or mySpec
return om
***************
*** 205,210 ****
"""
! refAttr = referenceAttribute or self.parentManager or self.aq_parent.aq_parent.id
! return getattr(self.aq_parent, refAttr, None)
def getParent(self, referenceAttribute='parentID'):
--- 208,214 ----
"""
! mySpec = self.getMySpecialist()
! refAttr = referenceAttribute or self.parentManager or mySpec.aq_parent.getId()
! return getattr(mySpec, refAttr, None)
def getParent(self, referenceAttribute='parentID'):
***************
*** 257,261 ****
--- 261,268 ----
displayCustomUpdate_pt = PageTemplateFile('zpt/Generic_displayRelatedObjects', globals())
+ addRelationship_pt = PageTemplateFile('zpt/addRelationship_ChooseObjectManager_ui', globals())
findNewRelationship_pt = PageTemplateFile('zpt/findNewRelationship_ui', globals())
+
+ class_default_for_related_object_types = () # by default you can't related to anything
_custom_skin_scripts=(
***************
*** 265,268 ****
--- 272,281 ----
)
+ def findSpecialistsForRelationship(self):
+ """
+ in base class we just return our relatable_object_types property.
+ """
+ return self.related_object_types
+
def getRelationshipManager(self):
return self.findApplication().getRelationshipManager()
***************
*** 272,276 ****
get my object manager ID
"""
! return self.aq_parent.getId()
def relationDeleted(self, relationshipItem):
--- 285,289 ----
get my object manager ID
"""
! return self.getMySpecialist().getId()
def relationDeleted(self, relationshipItem):
***************
*** 318,326 ****
if REQUEST is not None:
responseURL = REQUEST.get('responseURL',None)
-
if responseURL:
REQUEST.RESPONSE.redirect(responseURL)
else:
! self.displayUpdateForm_html(self, REQUEST)
def createAndAddObject(self, objectProperties=None, objectManager=None, objectRole=None, selfRole=None, createIfNone=0, contextID='', **kw):
--- 331,342 ----
if REQUEST is not None:
responseURL = REQUEST.get('responseURL',None)
if responseURL:
REQUEST.RESPONSE.redirect(responseURL)
else:
! REQUEST.RESPONSE.redirect(self.REQUEST.URL1 + '/displayUpdateForm_html')
!
! # don't change this return value! We need it for testing....
!
! return "OK!"
def createAndAddObject(self, objectProperties=None, objectManager=None, objectRole=None, selfRole=None, createIfNone=0, contextID='', **kw):
***************
*** 354,361 ****
If objectRole is not None, assign objectRole to the otherObject in this relationship.
If selfRole is not None, assign selfRole to self in this relationship.
"""
rm = self.getRelationshipManager()
! rm.relateObjects( object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole, createIfNone=createIfNone, contextID=contextID)
def removeObjectRelations(self, ids=None):
--- 370,379 ----
If objectRole is not None, assign objectRole to the otherObject in this relationship.
If selfRole is not None, assign selfRole to self in this relationship.
+ returns the relatioshipItem for self...
"""
rm = self.getRelationshipManager()
! selfRItem = rm.relateObjects( object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole, createIfNone=createIfNone, contextID=contextID)
! return selfRItem
def removeObjectRelations(self, ids=None):
***************
*** 371,374 ****
--- 389,393 ----
if ids:
+ ZApp_LOG("Removing object relations from object:" + `self.getId()` + ":" + `ids`)
self.getRelationshipManager().removeObjectRelations( ids )
***************
*** 406,415 ****
returns a list of dictionaries like so:
[
! {'relationshipID':rid,
! 'otherObjectID':objId,
! 'otherManagerID':manID,
! 'otherRole':otherRole,
! 'selfRole':selfRole,
! },
{....
},
--- 425,439 ----
returns a list of dictionaries like so:
[
! {
! 'relationshipID': the relationshipID,
! 'otherRIID': other object's relationshipItemID,
! 'otherObjectID': other object's ID,
! 'otherManagerID': other object's Manager,
! 'otherRole': other object's role..
! 'otherContextID': other object's contextID,
! 'selfRole': my roleName,
! 'selfRIID': my relationshipItemID,
! 'selfContextID': my contextID,
! },
{....
},
***************
*** 419,423 ****
if returnObjects is true, each dictionary also has 'otherObject':otherObject as a member.
"""
!
if objectTypes:
if type(objectTypes) == type(''):
--- 443,447 ----
if returnObjects is true, each dictionary also has 'otherObject':otherObject as a member.
"""
!
if objectTypes:
if type(objectTypes) == type(''):
Index: ZApp_RelationshipItem.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipItem.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ZApp_RelationshipItem.py 2 Jun 2003 14:46:08 -0000 1.5
--- ZApp_RelationshipItem.py 28 Oct 2003 20:27:03 -0000 1.6
***************
*** 13,18 ****
props = lpcol([
lprop(id='relationshipID'),
! lprop(id='objectID'),
! lprop(id='objectManager'),
lprop(id='roleID'),
lprop(id='contextID'),
--- 13,18 ----
props = lpcol([
lprop(id='relationshipID'),
! lprop(id='objectID',dbSize=255),
! lprop(id='objectManager',dbSize=50),
lprop(id='roleID'),
lprop(id='contextID'),
***************
*** 23,26 ****
--- 23,28 ----
meta_type = 'ZApp RelationshipItem'
+
+ _indexed_attrs = ('objectID',)
def getObject(self):
Index: ZApp_RelationshipManager.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipManager.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ZApp_RelationshipManager.py 3 Jul 2003 18:23:10 -0000 1.4
--- ZApp_RelationshipManager.py 28 Oct 2003 20:27:03 -0000 1.5
***************
*** 30,44 ****
return getattr(self, rItemsID)
- def getRelationshipItems(self, excludeIDs = None):
- """
- get all the relItems in this relationship.
- """
-
- rItemMan = self.getRelationshipItemManager()
- results = rItemMan.ZApp_getItems(relationshipID = self.id)
- if excludeIDs:
- results = filter(lambda x,eids=excludeIDs: x.id not in eids, results)
- return results
-
def relateObjects(self, object1, object2, object1Role=None, object2Role=None, createIfNone=0, contextID=''):
"""
--- 30,33 ----
***************
*** 65,70 ****
! rItem1 = relItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object1.id, objectManager=object1.Manager, roleID=role1ID)
! rItem2 = relItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object2.id, objectManager=object2.Manager, roleID=role2ID, contextID=contextID)
def removeObjects(self, object1, object2=None, object1Role=None, object2Role=None, object2Type=None, object2Manager=None):
--- 54,60 ----
! rItem1 = relItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object1.getPrimaryKeyValue(), objectManager=object1.Manager, roleID=role1ID)
! rItem2 = relItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object2.getPrimaryKeyValue(), objectManager=object2.Manager, roleID=role2ID, contextID=contextID)
! return rItem1
def removeObjects(self, object1, object2=None, object1Role=None, object2Role=None, object2Type=None, object2Manager=None):
***************
*** 98,102 ****
role2ID = role2IDs and role2IDs[0]
! rItems = rItemsMan.ZApp_getItems(objectID=object1.id, objectManager=object1.Manager, roleID=role1ID)
self.removeObjectRelations( rItems = rItems, role1ID = role1ID, role2ID = role2ID, o2Type = o2Type, o2Manager = o2Manager)
--- 88,92 ----
role2ID = role2IDs and role2IDs[0]
! rItems = rItemsMan.ZApp_getItems(objectID=object1.getPrimaryKeyValue(), objectManager=object1.Manager, roleID=role1ID)
self.removeObjectRelations( rItems = rItems, role1ID = role1ID, role2ID = role2ID, o2Type = o2Type, o2Manager = o2Manager)
***************
*** 166,170 ****
rItemsMan = self.getRelationshipItemManager()
! myRelationshipItems = rItemsMan.ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
riMan = self.getRoleManager()
--- 156,160 ----
rItemsMan = self.getRelationshipItemManager()
! myRelationshipItems = rItemsMan.ZApp_getItems( objectID=anObject.getPrimaryKeyValue(), objectManager=anObject.Manager)
riMan = self.getRoleManager()
***************
*** 234,238 ****
"""
! myRelationshipItems = self.getRelationshipItemManager().ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
riMan = self.getRoleManager()
--- 224,228 ----
"""
! myRelationshipItems = self.getRelationshipItemManager().ZApp_getItems( objectID=anObject.getPrimaryKeyValue(), objectManager=anObject.Manager)
riMan = self.getRoleManager()
***************
*** 254,258 ****
continue
! if (not ((rItem.objectManager == anObject.Manager) and (rItem.objectID == anObject.id))):
if objectTypes and (theObject.objectType not in objectTypes):
continue
--- 244,248 ----
continue
! if (not ((rItem.objectManager == anObject.Manager) and (rItem.objectID == anObject.getPrimaryKeyValue()))):
if objectTypes and (theObject.objectType not in objectTypes):
continue
Index: ZApp_Specialist.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Specialist.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** ZApp_Specialist.py 3 Jul 2003 18:05:07 -0000 1.29
--- ZApp_Specialist.py 28 Oct 2003 20:27:03 -0000 1.30
***************
*** 5,10 ****
import types
import os
- ZAPP_DEBUG=os.environ.get('ZAPP_DEBUG',0)
- ZAPP_DEBUG_BREAK=os.environ.get('ZAPP_DEBUG_BREAK',0)
from ZApp_LOG import ZApp_LOG
--- 5,8 ----
***************
*** 73,80 ****
class UniqueIDGenerator( Synchronized ):
! def __init__(self, debug=0):
self.lastTime = time.time()
- self.debug = debug
-
minDelta = 0.1
--- 71,76 ----
class UniqueIDGenerator( Synchronized ):
! def __init__(self):
self.lastTime = time.time()
minDelta = 0.1
***************
*** 104,108 ****
meta_type = 'Z App Specialist'
- debug = ZAPP_DEBUG
LeversSetsGroup = PlugInGroup('LeversSetsGroup', ['ZApp Lever Method Sets'], attr='leverList', title='Lever Sets')
--- 100,103 ----
***************
*** 176,189 ****
return 1
- def ZApp_setupDebug(self):
- """
- Just a method we can tickle...
- """
- if ZAPP_DEBUG_BREAK:
- ZApp_LOG("checking for ZAPP_DEBUG_BREAK %s -?- %s" % (ZAPP_DEBUG_BREAK, __name__))
- if ZAPP_DEBUG_BREAK == __name__:
- import pdb
- pdb.set_trace()
-
def ZApp_cleanDate(self, theDate):
""" Clean up a date """
--- 171,174 ----
***************
*** 545,549 ****
def ZApp_clearResultCache( self, itemID ):
! ZApp_LOG( "clearing result cache for itemID %s" % itemID )
self._rmCache( itemID )
--- 530,534 ----
def ZApp_clearResultCache( self, itemID ):
! ZApp_LOG( "clearing result cache for itemID %s in %s" % (itemID, self.getId()))
self._rmCache( itemID )
***************
*** 623,627 ****
return theIDs
! def ZApp_getItems(self, conditions=None, createIfNone=0, debug=0, displayQuery=0, **kw):
""" get my items that match conditions """
--- 608,612 ----
return theIDs
! def ZApp_getItems(self, conditions=None, createIfNone=0, displayQuery=0, **kw):
""" get my items that match conditions """
|