zapp-cvs-commit Mailing List for ZApp Framework (Page 8)
Brought to you by:
sspickle
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(24) |
Jul
(14) |
Aug
(19) |
Sep
(3) |
Oct
(21) |
Nov
(9) |
Dec
(8) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(23) |
Feb
(13) |
Mar
(37) |
Apr
(5) |
May
(15) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(13) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2005 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: <ssp...@us...> - 2003-08-12 13:49:23
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv3404
Modified Files:
ZApp_Application.py ZApp_RelatableItem.py
Log Message:
fixed bug in removeObjectRelations if there are none..
Index: ZApp_Application.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Application.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** ZApp_Application.py 7 Aug 2003 13:50:32 -0000 1.22
--- ZApp_Application.py 12 Aug 2003 13:32:13 -0000 1.23
***************
*** 250,254 ****
return results
!
def localeID(self):
return getattr(self, 'LOCALE_ID', 'TST')
--- 250,272 ----
return results
!
! SDT = 'SESSION_DATA_TYPE'
!
! def getUserSessions(self, browserID=None, create=0):
! """
! return the current session info object(s)
! """
!
! conditions = {
! 'dataType':self.SDT,
! 'Manager':'SessionData',
! 'objectID':self.REQUEST.AUTHENTICATED_USER.getUserName(),
! }
!
! if browserID is not None:
! conditions.update({'xml':'<xmlData browserID="%s"/>' % browserID})
!
! return self.MiscData.ZApp_getItems(conditions=conditions, createIfNone=create)
!
def localeID(self):
return getattr(self, 'LOCALE_ID', 'TST')
Index: ZApp_RelatableItem.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelatableItem.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** ZApp_RelatableItem.py 3 Jul 2003 18:05:07 -0000 1.17
--- ZApp_RelatableItem.py 12 Aug 2003 13:32:13 -0000 1.18
***************
*** 355,359 ****
ids = [x['selfRIID'] for x in self.objectRelations()]
! self.getRelationshipManager().removeObjectRelations( ids )
def removeObjectRelations_ui(self, ids, REQUEST=None):
--- 355,360 ----
ids = [x['selfRIID'] for x in self.objectRelations()]
! if ids:
! self.getRelationshipManager().removeObjectRelations( ids )
def removeObjectRelations_ui(self, ids, REQUEST=None):
|
|
From: <ssp...@us...> - 2003-08-08 02:47:57
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv28722
Modified Files:
ZApp_CMFBase.py
Log Message:
comment out some debugging 'print' statements..
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ZApp_CMFBase.py 7 Aug 2003 17:28:14 -0000 1.14
--- ZApp_CMFBase.py 8 Aug 2003 02:47:54 -0000 1.15
***************
*** 86,90 ****
#for action in actions:
#if action.getId() ==
! print "in notify copy.. "
copyID = '_v_' + self.id + 'copyXML'
setattr(container, copyID, self.safeMiscData.getXMLDict())
--- 86,90 ----
#for action in actions:
#if action.getId() ==
! #print "in notify copy.. "
copyID = '_v_' + self.id + 'copyXML'
setattr(container, copyID, self.safeMiscData.getXMLDict())
***************
*** 93,97 ****
""" restore XML from volitile attribute.. """
! print "in manage_afterAdd", self.id
PortalContent.manage_afterAdd(self, item, container)
ZApp_Base.manage_afterAdd(self, item, container)
--- 93,97 ----
""" restore XML from volitile attribute.. """
! #print "in manage_afterAdd", self.id
PortalContent.manage_afterAdd(self, item, container)
ZApp_Base.manage_afterAdd(self, item, container)
|
|
From: <ssp...@us...> - 2003-08-07 17:51:58
|
Update of /cvsroot/zapp/ZApp/zpt
In directory sc8-pr-cvs1:/tmp/cvs-serv31845/zpt
Modified Files:
Generic_displayRelatedObjects.zpt
Log Message:
fixed typo in displayrelatedobejcts
Index: Generic_displayRelatedObjects.zpt
===================================================================
RCS file: /cvsroot/zapp/ZApp/zpt/Generic_displayRelatedObjects.zpt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Generic_displayRelatedObjects.zpt 7 Aug 2003 17:28:14 -0000 1.3
--- Generic_displayRelatedObjects.zpt 7 Aug 2003 17:51:55 -0000 1.4
***************
*** 5,9 ****
<tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
! <span tal:omit-tag="" tal:define="otherObject python:objRelation.otherObject">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
--- 5,9 ----
<tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
! <span tal:omit-tag="" tal:define="otherObject python:objRelation.get('otherObject',None)">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
|
|
From: <ssp...@us...> - 2003-08-07 17:39:07
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv27511
Modified Files:
ZApp_CMFBase.py
Log Message:
fixed display of related CMF things..
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** ZApp_CMFBase.py 7 Aug 2003 16:35:11 -0000 1.13
--- ZApp_CMFBase.py 7 Aug 2003 17:28:14 -0000 1.14
***************
*** 25,28 ****
--- 25,29 ----
from Products.CMFCore import CMFCorePermissions
from ZApp_MiscData import ZApp_MiscDataUser
+ from ZApp_RelatableItem import ZApp_RelatedObject
from Products.FreeRangeDS import FreeRangeDS, _v_dm_
***************
*** 31,35 ****
import tempfile
! class ZApp_CMFBase(FreeRangeDS, ZApp_Base, PortalContent, DefaultDublinCoreImpl, ZApp_MiscDataUser):
meta_type = 'ZApp CMF Content Type'
--- 32,36 ----
import tempfile
! class ZApp_CMFBase(FreeRangeDS, ZApp_Base, PortalContent, DefaultDublinCoreImpl, ZApp_MiscDataUser, ZApp_RelatedObject):
meta_type = 'ZApp CMF Content Type'
|
|
From: <ssp...@us...> - 2003-08-07 17:39:06
|
Update of /cvsroot/zapp/ZApp/zpt
In directory sc8-pr-cvs1:/tmp/cvs-serv27511/zpt
Modified Files:
Generic_displayRelatedObjects.zpt
Log Message:
fixed display of related CMF things..
Index: Generic_displayRelatedObjects.zpt
===================================================================
RCS file: /cvsroot/zapp/ZApp/zpt/Generic_displayRelatedObjects.zpt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Generic_displayRelatedObjects.zpt 3 Jul 2003 18:05:08 -0000 1.2
--- Generic_displayRelatedObjects.zpt 7 Aug 2003 17:28:14 -0000 1.3
***************
*** 5,9 ****
<tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
! <span tal:omit-tag="" tal:define="otherObject objRelation/otherObject">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
--- 5,9 ----
<tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
! <span tal:omit-tag="" tal:define="otherObject python:objRelation.otherObject">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
|
|
From: <ssp...@us...> - 2003-08-07 16:35:15
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv16318
Modified Files:
ZApp_CMFBase.py
Log Message:
fixed problem with manage_afterAdd
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ZApp_CMFBase.py 7 Aug 2003 13:50:32 -0000 1.12
--- ZApp_CMFBase.py 7 Aug 2003 16:35:11 -0000 1.13
***************
*** 12,16 ****
props = lpcol(
! [lprop(id='portal_type'),
]
)
--- 12,16 ----
props = lpcol(
! [lprop(id='cmf_portal_type'),
]
)
***************
*** 85,88 ****
--- 85,89 ----
#for action in actions:
#if action.getId() ==
+ print "in notify copy.. "
copyID = '_v_' + self.id + 'copyXML'
setattr(container, copyID, self.safeMiscData.getXMLDict())
***************
*** 91,95 ****
--- 92,98 ----
""" 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
***************
*** 236,240 ****
),
},
! )
--- 239,243 ----
),
},
! )
|
|
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=''):
|
|
From: <ssp...@us...> - 2003-08-07 13:50:35
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic
In directory sc8-pr-cvs1:/tmp/cvs-serv14418/skins/zapp_generic
Modified Files:
zapp_cmf_object_type_edit_form.pt zapp_cmf_object_view.pt
Log Message:
improve CMF base class so support copy/paste/delete with miscdata triggers
Index: zapp_cmf_object_type_edit_form.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_type_edit_form.pt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** zapp_cmf_object_type_edit_form.pt 3 Jul 2003 22:30:02 -0000 1.2
--- zapp_cmf_object_type_edit_form.pt 7 Aug 2003 13:50:32 -0000 1.3
***************
*** 45,48 ****
--- 45,49 ----
'record' (a structure or dictionary),
'records' (a list of structures of dictionaries),)
+ 'records2D' (a 2D array of dicts.. needs a parameter 'pitch')
if record or 'records' is used... there is also:
***************
*** 66,70 ****
subDefs subObject/zapp_properties | python:[]">
! <table tal:condition="python:propType in ['float','int','long','string','date']">
<tr><td><input type="checkbox" name="names:list" tal:attributes="value propName"/></td> <td tal:content="string:${propName}(${propType})"/></tr>
</table>
--- 67,71 ----
subDefs subObject/zapp_properties | python:[]">
! <table tal:condition="python:propType in ['float','int','long','string','date','boolean']">
<tr><td><input type="checkbox" name="names:list" tal:attributes="value propName"/></td> <td tal:content="string:${propName}(${propType})"/></tr>
</table>
Index: zapp_cmf_object_view.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_view.pt,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** zapp_cmf_object_view.pt 3 Jul 2003 22:30:02 -0000 1.3
--- zapp_cmf_object_view.pt 7 Aug 2003 13:50:32 -0000 1.4
***************
*** 3,8 ****
metal:use-macro="here/main_template/macros/master">
<metal:block fill-slot="base">
! <base href=""
! tal:attributes="href python: here.absolute_url() + '/'">
</metal:block>
<body>
--- 3,7 ----
metal:use-macro="here/main_template/macros/master">
<metal:block fill-slot="base">
! <base href="" tal:attributes="href python: here.absolute_url() + '/'">
</metal:block>
<body>
|
|
From: <ssp...@us...> - 2003-08-06 17:39:24
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv11708
Added Files:
xmlrpc_mp.py
Log Message:
oops! This should've been added yesterday!
--- NEW FILE: xmlrpc_mp.py ---
"""
xmlrpclib monkeypatch..
automatically convert DateTime objects to/from xmlrpc representation..
"""
import xmlrpclib
from DateTime import DateTime
def encodeFromZopeTime(self, out):
xmlrpclib.DateTime.encode(xmlrpclib.DateTime( self.timeTime()), out)
DateTime.encode = encodeFromZopeTime
xmlrpclib.WRAPPERS = tuple(list(xmlrpclib.WRAPPERS) + [DateTime])
def new_endDateTime(self, data):
dParts = data.split('T')
if len(dParts[0]) == 8:
data = '-'.join((dParts[0][:4],dParts[0][4:6],dParts[0][6:8])) + 'T' + dParts[1]
value = DateTime( data )
self.append(value)
xmlrpclib.Unmarshaller.end_dateTime = new_endDateTime
xmlrpclib.Unmarshaller.dispatch["dateTime.iso8601"] = new_endDateTime
|
|
From: <ssp...@us...> - 2003-08-06 05:36:51
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv12705
Modified Files:
ZApp_MiscData.py __init__.py
Log Message:
moved monkeypatch to ZApp..
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ZApp_MiscData.py 31 Jul 2003 04:55:21 -0000 1.15
--- ZApp_MiscData.py 6 Aug 2003 05:36:48 -0000 1.16
***************
*** 15,20 ****
from Products.PlugIns import defaultConstructors
- from DateTime import DateTime
-
import ZApp_Base
import string
--- 15,18 ----
***************
*** 70,85 ****
return self.xml
- def decodeXMLDate(self, value):
- """ decode the ISO XML date object"""
- value = value.value
- if len(value)>4 and value[4] != '-':
- value = '-'.join([value[:4],value[4:6],value[6:]])
- return DateTime(value)
-
def getXMLAttr(self, attr, default=None, escNL=0):
""" get an XML based attribute."""
value = self._v_xmlDict.get(attr, default)
- if isinstance(value, xmlrpclib.DateTime):
- value = self.decodeXMLDate(value)
return value
--- 68,74 ----
***************
*** 98,104 ****
d = self._v_xmlDict # getting _v_xmlDict insures the cache is setup
- if isinstance(value, DateTime):
- value = xmlrpclib.DateTime(value.timeTime())
-
d[attr] = value
--- 87,90 ----
Index: __init__.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/__init__.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** __init__.py 30 Jun 2003 20:25:05 -0000 1.15
--- __init__.py 6 Aug 2003 05:36:48 -0000 1.16
***************
*** 34,37 ****
--- 34,39 ----
allow_module('Products.ZApp.ZApp_Utils')
+ import xmlrpc_mp
+
def initialize(context, debug=None):
|
|
From: <ssp...@us...> - 2003-07-31 05:11:50
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv24800
Modified Files:
ZApp_MiscData.py
Log Message:
watch out for misc data values that try to marshal 'None'. xmlrpclib really doesn't care for that!
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ZApp_MiscData.py 3 Jul 2003 22:30:02 -0000 1.14
--- ZApp_MiscData.py 31 Jul 2003 04:55:21 -0000 1.15
***************
*** 362,367 ****
if typecode:
value = self.applyTypeConverter(typecode, value, args)
- result[attr] = value
return result
--- 362,369 ----
if typecode:
value = self.applyTypeConverter(typecode, value, args)
+
+ if value is not None:
+ result[attr] = value
return result
***************
*** 379,383 ****
if val:
val = `val`
!
result[p['id']] = val
--- 381,387 ----
if val:
val = `val`
! elif val is None:
! val = ''
!
result[p['id']] = val
|
|
From: <ssp...@us...> - 2003-07-04 17:59:07
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv1886
Modified Files:
ZApp_Relationship.py
Log Message:
fixed excludeIDs masking problem..
Index: ZApp_Relationship.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Relationship.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ZApp_Relationship.py 1 Jul 2003 22:22:03 -0000 1.5
--- ZApp_Relationship.py 4 Jul 2003 17:59:04 -0000 1.6
***************
*** 28,32 ****
results = rItemMan.ZApp_getItems(relationshipID = self.id)
if excludeIDs:
! results = filter(lambda x: x.id not in excludeIDs, results)
return results
--- 28,32 ----
results = rItemMan.ZApp_getItems(relationshipID = self.id)
if excludeIDs:
! results = filter(lambda x,eids=exlcudeIDs: x.id not in eids, results)
return results
|
|
From: <ssp...@us...> - 2003-07-03 22:30:25
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv13103
Added Files:
addZApp_RelationshipManagerForm.dtml
Log Message:
save fixes..
--- NEW FILE: addZApp_RelationshipManagerForm.dtml ---
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add Specialist'
)">
<FORM ACTION="." METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-label">Id</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
&dtml-ZApp_Specialist_SubclassID;
<INPUT type="hidden" name="id" value="&dtml-ZApp_Specialist_SubclassID;">
</TD>
</TR>
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<div class="form-optional">Title</div>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="title" SIZE="40">
</TD>
</TR>
<TR>
<TD><div class="form-label">Create Default Rack of type</div></TD>
<TD>
<SELECT SIZE=1 NAME="rack">
<dtml-in "RacksMetaTypes(this())" mapping sort=name>
<OPTION <dtml-if "name == 'Rack'">SELECTED</dtml-if>
VALUE="&dtml-name;"><dtml-var name></OPTION>
</dtml-in>
<OPTION VALUE="">(none)</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD><div class="form-label">Use ZApp Lever Set</div></TD>
<TD>
<SELECT SIZE=1 NAME="leverSet">
<dtml-in "findZApp_Application().getLeverSetsFromList()" sort="id">
<OPTION VALUE="&dtml-id;"><dtml-var id></OPTION>
</dtml-in>
<OPTION VALUE="">(none)</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD></TD>
<TD>
<INPUT class="form-element" name="&dtml-ZApp_subClass_addMethod;:method" "TYPE="SUBMIT" VALUE=" Add ">
</TD>
</TR>
</TABLE>
</FORM>
<dtml-var manage_page_footer>
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic
In directory sc8-pr-cvs1:/tmp/cvs-serv12961/skins/zapp_generic
Modified Files:
zapp_cmf_object_edit_form.pt zapp_cmf_object_type_edit.py
zapp_cmf_object_type_edit_form.pt zapp_cmf_object_view.pt
Log Message:
save fixes..
Index: zapp_cmf_object_edit_form.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_edit_form.pt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zapp_cmf_object_edit_form.pt 25 Jun 2003 11:45:53 -0000 1.1
--- zapp_cmf_object_edit_form.pt 3 Jul 2003 22:30:02 -0000 1.2
***************
*** 27,31 ****
-->
! <div tal:define="myApp python:here.findApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
--- 27,31 ----
-->
! <div tal:define="myApp python:here.getApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
Index: zapp_cmf_object_type_edit.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_type_edit.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zapp_cmf_object_type_edit.py 25 Jun 2003 11:45:53 -0000 1.1
--- zapp_cmf_object_type_edit.py 3 Jul 2003 22:30:02 -0000 1.2
***************
*** 1,5 ****
## Script (Python) "question_edit"
! myApp = context.findApplication()
myType = context.portal_type
miscData = myApp.MiscData
--- 1,5 ----
## Script (Python) "question_edit"
! myApp = context.getApplication()
myType = context.portal_type
miscData = myApp.MiscData
Index: zapp_cmf_object_type_edit_form.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_type_edit_form.pt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zapp_cmf_object_type_edit_form.pt 25 Jun 2003 11:45:53 -0000 1.1
--- zapp_cmf_object_type_edit_form.pt 3 Jul 2003 22:30:02 -0000 1.2
***************
*** 51,55 ****
-->
! <div tal:define="myApp python:here.findApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
--- 51,55 ----
-->
! <div tal:define="myApp python:here.getApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
Index: zapp_cmf_object_view.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_view.pt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** zapp_cmf_object_view.pt 3 Jul 2003 18:05:07 -0000 1.2
--- zapp_cmf_object_view.pt 3 Jul 2003 22:30:02 -0000 1.3
***************
*** 10,14 ****
<div metal:fill-slot="main">
! <div tal:define="myApp python:here.findApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
--- 10,14 ----
<div metal:fill-slot="main">
! <div tal:define="myApp python:here.getApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
|
|
From: <ssp...@us...> - 2003-07-03 22:30:06
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv12961
Modified Files:
ZApp_Application.py ZApp_CMFBase.py ZApp_MiscData.py
Log Message:
save fixes..
Index: ZApp_Application.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Application.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** ZApp_Application.py 30 Jun 2003 20:25:05 -0000 1.20
--- ZApp_Application.py 3 Jul 2003 22:30:02 -0000 1.21
***************
*** 212,217 ****
"""
specCache = self._v_SpecialistsCache
! theSpecialistPath = '%s' % '/'.join(specCache.get(specName,None))
! return self.restrictedTraverse( theSpecialistPath )
def getRelationshipManager(self):
--- 212,220 ----
"""
specCache = self._v_SpecialistsCache
! specEntry = specCache.get(specName,None)
!
! theSpecialistPath = specEntry and ('%s' % '/'.join(specEntry))
! result = theSpecialistPath and self.restrictedTraverse( theSpecialistPath )
! return result
def getRelationshipManager(self):
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ZApp_CMFBase.py 26 Jun 2003 15:18:52 -0000 1.10
--- ZApp_CMFBase.py 3 Jul 2003 22:30:02 -0000 1.11
***************
*** 31,34 ****
--- 31,36 ----
)
+ manage_options = PortalContent.manage_options
+
# Declarative security (replaces __ac_permissions__)
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** ZApp_MiscData.py 3 Jul 2003 18:23:10 -0000 1.13
--- ZApp_MiscData.py 3 Jul 2003 22:30:02 -0000 1.14
***************
*** 183,187 ****
def getMiscDataSpecialist(self):
! return self.findApplication().getSpecialist('MiscData')
def getMiscData(self, Manager=None, dataType=''):
--- 183,195 ----
def getMiscDataSpecialist(self):
! mds = self.findApplication().getSpecialist('MiscData')
! if not mds:
! try:
! # acquisition failed... try CMF skin, if we're in context..
! #
! mds = self.getApplication().getSpecialist('MiscData')
! except AttributeError:
! pass
! return mds
def getMiscData(self, Manager=None, dataType=''):
***************
*** 367,371 ****
val = getattr(self, p['id'])
if p['type'] == 'date':
! val = val.ISO()
elif p['type'] != 'string':
if val:
--- 375,379 ----
val = getattr(self, p['id'])
if p['type'] == 'date':
! val = (hasattr(val,'ISO') and val.ISO()) or `val`
elif p['type'] != 'string':
if val:
|
|
From: <ssp...@us...> - 2003-07-03 18:23:15
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv21670
Modified Files:
ZApp_MiscData.py ZApp_RelationshipManager.py
addZApp_SpecialistForm.dtml
Log Message:
fixed a couple more that turned up while working on image display issue..
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ZApp_MiscData.py 25 Jun 2003 11:45:53 -0000 1.12
--- ZApp_MiscData.py 3 Jul 2003 18:23:10 -0000 1.13
***************
*** 366,371 ****
if p['id']:
val = getattr(self, p['id'])
! if p['type'] != 'string':
! val = `val`
result[p['id']] = val
--- 366,375 ----
if p['id']:
val = getattr(self, p['id'])
! if p['type'] == 'date':
! val = val.ISO()
! elif p['type'] != 'string':
! if val:
! val = `val`
!
result[p['id']] = val
Index: ZApp_RelationshipManager.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipManager.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ZApp_RelationshipManager.py 3 Jul 2003 18:05:07 -0000 1.3
--- ZApp_RelationshipManager.py 3 Jul 2003 18:23:10 -0000 1.4
***************
*** 332,336 ****
ZApp_Specialist.setupClassInit(subClass=ZApp_RelationshipManager)
! manage_addZApp_RelationshipManagerForm = DTMLFile('addZApp_SpecialistForm',
globals(),
RacksMetaTypes = PlugInFinder(Specialist.RacksGroup),
--- 332,336 ----
ZApp_Specialist.setupClassInit(subClass=ZApp_RelationshipManager)
! manage_addZApp_RelationshipManagerForm = DTMLFile('addZApp_RelationshipManagerForm',
globals(),
RacksMetaTypes = PlugInFinder(Specialist.RacksGroup),
Index: addZApp_SpecialistForm.dtml
===================================================================
RCS file: /cvsroot/zapp/ZApp/addZApp_SpecialistForm.dtml,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** addZApp_SpecialistForm.dtml 30 Jun 2003 20:25:05 -0000 1.3
--- addZApp_SpecialistForm.dtml 3 Jul 2003 18:23:10 -0000 1.4
***************
*** 12,21 ****
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
- <dtml-if ZApp_Specialist_SubclassID>
- &dtml-ZApp_Specialist_SubclassID;
- <INPUT type="hidden" name="id" value="&dtml-ZApp_Specialist_SubclassID;">
- <dtml-else>
<INPUT TYPE="TEXT" NAME="id" SIZE="40" VALUE="">
- </dtml-if>
</TD>
</TR>
--- 12,16 ----
***************
*** 56,64 ****
<TD></TD>
<TD>
- <dtml-if ZApp_subClass_addMethod>
- <INPUT class="form-element" name="&dtml-ZApp_subClass_addMethod;:method" "TYPE="SUBMIT" VALUE=" Add ">
- <dtml-else>
<INPUT class="form-element" name="manage_addZApp_Specialist:method" "TYPE="SUBMIT" VALUE=" Add ">
- </dtml-if>
</TD>
</TR>
--- 51,55 ----
|
|
From: <ssp...@us...> - 2003-07-03 18:05:12
|
Update of /cvsroot/zapp/ZApp/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv18754/tests
Modified Files:
test_RelationsBase.py
Log Message:
fixed some ZApp bugs..
Index: test_RelationsBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/tests/test_RelationsBase.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_RelationsBase.py 1 Jul 2003 22:22:03 -0000 1.9
--- test_RelationsBase.py 3 Jul 2003 18:05:07 -0000 1.10
***************
*** 108,114 ****
self.rm.commit_subtransaction()
! rIds = [x['relationshipID'] for x in object1.objectRelations()]
!
! object1.removeObjectRelations( rIds )
self.rm.commit_subtransaction()
--- 108,112 ----
self.rm.commit_subtransaction()
! object1.removeObjectRelations()
self.rm.commit_subtransaction()
|
|
From: <ssp...@us...> - 2003-07-03 18:05:11
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic
In directory sc8-pr-cvs1:/tmp/cvs-serv18754/skins/zapp_generic
Modified Files:
zapp_cmf_object_edit.py zapp_cmf_object_view.pt
Log Message:
fixed some ZApp bugs..
Index: zapp_cmf_object_edit.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_edit.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zapp_cmf_object_edit.py 25 Jun 2003 11:45:53 -0000 1.1
--- zapp_cmf_object_edit.py 3 Jul 2003 18:05:07 -0000 1.2
***************
*** 5,15 ****
--- 5,19 ----
submitValue = context.REQUEST.get('submit','')
+
if submitValue == 'add row':
propName = context.REQUEST.get('propToChange','')
+
if propName:
currVal = context.REQUEST.get(propName, [])
currVal += [{}]
+
elif submitValue == 'delete row':
propName = context.REQUEST.get('propToChange','')
+
if propName:
currVal = context.REQUEST.get(propName, [])
***************
*** 18,20 ****
--- 22,25 ----
context.safeMiscData.setXMLAttrs(dict = dict)
+
context.REQUEST.RESPONSE.redirect('zapp_cmf_object_edit_form')
Index: zapp_cmf_object_view.pt
===================================================================
RCS file: /cvsroot/zapp/ZApp/skins/zapp_generic/zapp_cmf_object_view.pt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zapp_cmf_object_view.pt 25 Jun 2003 11:45:53 -0000 1.1
--- zapp_cmf_object_view.pt 3 Jul 2003 18:05:07 -0000 1.2
***************
*** 13,17 ****
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
! typePropertiesObjects python:miscDataSpecialist.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='CMFPropertiesFor' + myType);
myTypePropertiesMiscData python:typePropertiesObjects and typePropertiesObjects[0].getXMLDict();
myProperties python:here.safeMiscData.getXMLDict()">
--- 13,17 ----
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
! typePropertiesObjects python:miscDataSpecialist.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='ZCMFPropsFor' + myType);
myTypePropertiesMiscData python:typePropertiesObjects and typePropertiesObjects[0].getXMLDict();
myProperties python:here.safeMiscData.getXMLDict()">
|
|
From: <ssp...@us...> - 2003-07-03 18:05:11
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv18754
Modified Files:
ZApp_LeverMethods.py ZApp_RelatableItem.py
ZApp_RelationshipManager.py ZApp_Specialist.py
Log Message:
fixed some ZApp bugs..
Index: ZApp_LeverMethods.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_LeverMethods.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ZApp_LeverMethods.py 28 Mar 2003 20:38:23 -0000 1.9
--- ZApp_LeverMethods.py 3 Jul 2003 18:05:07 -0000 1.10
***************
*** 215,219 ****
return a list of avaiable lever set ids..
"""
! return [''] + map(lambda x: x.getId(), self.findZApp_Application().getLeverSetsFromList())
def initialize(context):
--- 215,219 ----
return a list of avaiable lever set ids..
"""
! return [''] + map(lambda x: x.getId(), self.findZApp_Application().getLeverSetsFromList( exclude=''))
def initialize(context):
Index: ZApp_RelatableItem.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelatableItem.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ZApp_RelatableItem.py 1 Jul 2003 22:22:03 -0000 1.16
--- ZApp_RelatableItem.py 3 Jul 2003 18:05:07 -0000 1.17
***************
*** 262,265 ****
--- 262,266 ----
"WITH self.getObjectType() COMPUTE objectType=RESULT",
"WITH self.getObjectManagerID() COMPUTE Manager=RESULT",
+ "WHEN OBJECT DELETED CALL self.removeObjectRelations()",
)
***************
*** 284,305 ****
return result
! def createAndAddObject_ui(self, objectProperties=None, objectManager=None, objectRole=None, selfRole=None, createIfNone=0, contextID='', **kw):
"""
A UI method to create and add an object..
"""
! if objectProperties is None:
! objectProperties = {}
if kw:
! objectProperties.update(kw)
! self.createAndAddObject(objectProperties=objectProperties, objectManager=objectManager, objectRole=objectRole, selfRole=selfRole, createIfNone=createIfNone, contextID=contextID)
! responseURL = self.REQUEST.get('responseURL',None)
! if responseURL:
! self.REQUEST.RESPONSE.redirect(responseURL)
!
! return "OK!"
def createAndAddObject(self, objectProperties=None, objectManager=None, objectRole=None, selfRole=None, createIfNone=0, contextID='', **kw):
--- 285,311 ----
return result
! def createAndAddObject_ui(self, objectProperties=None, objectManager=None, objectRole=None, selfRole=None, createIfNone=0, contextID='', REQUEST=None, **kw):
"""
A UI method to create and add an object..
"""
!
! cond = {}
!
! if objectProperties is not None:
! for k in objectProperties.keys():
! cond[k] = objectProperties[k]
if kw:
! cond.update(kw)
! self.createAndAddObject(objectProperties=cond, objectManager=objectManager, objectRole=objectRole, selfRole=selfRole, createIfNone=createIfNone, contextID=contextID)
! 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):
***************
*** 323,326 ****
--- 329,333 ----
if not theObject:
theObject = theManager.ZApp_createNewItem( objectProperties )
+
self.addObject( otherObject=theObject, objectRole=objectRole, selfRole=selfRole, createIfNone=createIfNone, contextID=contextID)
return theObject
***************
*** 337,354 ****
rm.relateObjects( object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole, createIfNone=createIfNone, contextID=contextID)
! def removeObjectRelations(self, relationshipIDs):
"""
remove the relationships with the given relationship IDs..
"""
- self.getRelationshipManager().removeObjectRelations( relationshipIDs)
! def removeObjectRelations_ui(self, relationshipIDs, REQUEST=None):
! """
! remove the relationships with the given relationship IDs.. + UI fluff..
! """
! if relationshipIDs:
! self.removeObjectRelations( relationshipIDs )
if REQUEST is not None:
responseURL = self.REQUEST.get('responseURL',None)
--- 344,368 ----
rm.relateObjects( object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole, createIfNone=createIfNone, contextID=contextID)
! def removeObjectRelations(self, ids=None):
"""
remove the relationships with the given relationship IDs..
"""
! if ids is None:
! """
! Special case... this deletes all the relationships in which this object participates.
! """
! ids = [x['selfRIID'] for x in self.objectRelations()]
! self.getRelationshipManager().removeObjectRelations( ids )
+ def removeObjectRelations_ui(self, ids, REQUEST=None):
+ """
+ remove the relationships with the given relationship IDs.. + UI fluff..
+
+ this method requires ids to be passed...
+ """
+ if ids:
+ self.removeObjectRelations( ids )
if REQUEST is not None:
responseURL = self.REQUEST.get('responseURL',None)
***************
*** 357,361 ****
self.REQUEST.RESPONSE.redirect(responseURL)
! return self.manage_main(self, REQUEST)
else:
raise RuntimeError, "I need some ids!"
--- 371,375 ----
self.REQUEST.RESPONSE.redirect(responseURL)
! return self.displayUpdateForm_html(self, REQUEST)
else:
raise RuntimeError, "I need some ids!"
***************
*** 432,436 ****
raise RuntimeError, "No relationship info provided.. "
! rItemMan = self.getRelationshipItemManager()
for relInfo in relationInfo:
--- 446,450 ----
raise RuntimeError, "No relationship info provided.. "
! rItemMan = self.getRelationshipManager().getRelationshipItemManager()
for relInfo in relationInfo:
***************
*** 447,451 ****
self.REQUEST.RESPONSE.redirect(responseURL)
! return self.manage_main(self, REQUEST)
def nextContextID(self, objectTypes=None, objectRoles=None, selfRoles=None):
--- 461,465 ----
self.REQUEST.RESPONSE.redirect(responseURL)
! return self.displayUpdateForm_html(self, REQUEST)
def nextContextID(self, objectTypes=None, objectRoles=None, selfRoles=None):
Index: ZApp_RelationshipManager.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipManager.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ZApp_RelationshipManager.py 1 Jul 2003 22:22:03 -0000 1.2
--- ZApp_RelationshipManager.py 3 Jul 2003 18:05:07 -0000 1.3
***************
*** 68,81 ****
rItem2 = relItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object2.id, objectManager=object2.Manager, roleID=role2ID, contextID=contextID)
- def removeObjectRelations(self, relationshipIDs):
- """
- remove the relationships with the given relationship IDs..
- """
-
- rItemsMan = self.getRelationshipItemManager()
-
- for rItem in rItemsMan.ZApp_getItems( relationshipID = relationshipIDs):
- rItem.manage_delete()
-
def removeObjects(self, object1, object2=None, object1Role=None, object2Role=None, object2Type=None, object2Manager=None):
"""
--- 68,71 ----
***************
*** 108,116 ****
role2ID = role2IDs and role2IDs[0]
! relationshipIDs = []
! for rItem1 in rItemsMan.ZApp_getItems(objectID=object1.id, objectManager=object1.Manager, roleID=role1ID):
theRID=rItem1.relationshipID
! for rItem2 in rItemsMan.ZApp_getItems(relationshipID=rItem1.relationshipID, objectManager=o2Manager, roleID=role2ID):
! if (not ((rItem2.objectID == object1.id) and (rItem2.objectManager == object2.Manager))):
rItem2.manage_delete()
--- 98,128 ----
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)
!
! def removeObjectRelations(self, rItemIDs=None, rItems=None, role1ID='', role2ID='', o2Type='', o2Manager=''):
! """
! remove the relationships with the given relationship items, or relationship item ids..
! """
!
! rItemsMan = self.getRelationshipItemManager()
!
! if not rItems:
! if not rItemIDs:
! raise RuntimeError, "remove object relations needs either items or itemIDs.. "
!
! rItems = rItemsMan.ZApp_getItems( relationshipItemID = rItemIDs )
!
! for rItem1 in rItems:
theRID=rItem1.relationshipID
! for rItem2 in rItemsMan.ZApp_getItems(relationshipID=theRID, objectManager=o2Manager, roleID=role2ID):
! if rItem2.id != rItem1.id:
! if o2Type:
! theObject = rItem2.getObject()
! if theObject:
! if theObject.objectType != o2Type:
! continue
!
rItem2.manage_delete()
Index: ZApp_Specialist.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Specialist.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** ZApp_Specialist.py 30 Jun 2003 20:25:05 -0000 1.28
--- ZApp_Specialist.py 3 Jul 2003 18:05:07 -0000 1.29
***************
*** 10,13 ****
--- 10,15 ----
from ZApp_LOG import ZApp_LOG
+ from DateTime import DateTime
+
from copy import copy
import string
***************
*** 187,196 ****
""" Clean up a date """
- import DateTime
-
if theDate.year() > 1100:
return theDate
else:
! now = DateTime.DateTime()
return "%i/%i/%i" % (now.year(), now.month(), now.day())
--- 189,196 ----
""" Clean up a date """
if theDate.year() > 1100:
return theDate
else:
! now = DateTime()
return "%i/%i/%i" % (now.year(), now.month(), now.day())
***************
*** 464,468 ****
itemType = item['type']
mode = item.get('mode','')
! defaultVal = item.get('prop_default','')
if itemID not in ('title','id'):
theType = typeTable.get(itemType,'')
--- 464,474 ----
itemType = item['type']
mode = item.get('mode','')
! init_method = item.get('form_init_method','')
!
! if init_method:
! defaultVal = eval( init_method )
! else:
! defaultVal = item.get('prop_default','')
!
if itemID not in ('title','id'):
theType = typeTable.get(itemType,'')
***************
*** 716,720 ****
return self.manage_main(self,REQUEST,update_menu=1)
! def initialize(context, subClass=ZApp_Specialist, addMethod=manage_addZApp_Specialist, addForm=manage_addZApp_Specialist):
context.registerClass(
--- 722,726 ----
return self.manage_main(self,REQUEST,update_menu=1)
! def initialize(context, subClass=ZApp_Specialist, addMethod=manage_addZApp_Specialist, addForm=manage_addZApp_SpecialistForm):
context.registerClass(
|
|
From: <ssp...@us...> - 2003-07-03 18:05:11
|
Update of /cvsroot/zapp/ZApp/zpt
In directory sc8-pr-cvs1:/tmp/cvs-serv18754/zpt
Modified Files:
Generic_displayRelatedObjects.zpt
Log Message:
fixed some ZApp bugs..
Index: Generic_displayRelatedObjects.zpt
===================================================================
RCS file: /cvsroot/zapp/ZApp/zpt/Generic_displayRelatedObjects.zpt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Generic_displayRelatedObjects.zpt 1 Jul 2003 22:22:03 -0000 1.1
--- Generic_displayRelatedObjects.zpt 3 Jul 2003 18:05:08 -0000 1.2
***************
*** 3,19 ****
<form action="" tal:attributes="action request/URL1" method="post">
<table >
! <tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Object Type</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
<td tal:content="objRelation/otherManagerID"/>
<td><a tal:content="objRelation/otherObjectID" tal:attributes="href string:${objRelation/otherObject/absolute_url}/displayUpdateForm_html"/></td>
! <td tal:content="objRelation/otherObject/objectType"/>
<td><input name="relationInfo.contextID:records" tal:attributes="value objRelation/otherContextID"/></td>
!
</tr>
<tr tal:condition="objRelations"><td colspan="3">
<input type="submit" value="Delete Relation" name="removeObjectRelations_ui:method">
! <input tal:condition="objRelations" type="submit" value="Edit Selected Relations" name="editRelations_pt:method">
</td></tr>
<tr><td colspan="3"><input type="submit" value="Relate Other Object" name="findNewRelationship_pt:method">
--- 3,20 ----
<form action="" tal:attributes="action request/URL1" method="post">
<table >
! <tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Info</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
+ <span tal:omit-tag="" tal:define="otherObject objRelation/otherObject">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
<td tal:content="objRelation/otherManagerID"/>
<td><a tal:content="objRelation/otherObjectID" tal:attributes="href string:${objRelation/otherObject/absolute_url}/displayUpdateForm_html"/></td>
! <td tal:content="otherObject/Info | otherObject/name | otherObject/description | otherObject/objectType | nothing"/>
<td><input name="relationInfo.contextID:records" tal:attributes="value objRelation/otherContextID"/></td>
! </span>
</tr>
<tr tal:condition="objRelations"><td colspan="3">
<input type="submit" value="Delete Relation" name="removeObjectRelations_ui:method">
! <input tal:condition="objRelations" type="submit" value="Edit Selected Relations" name="editRelations_ui:method">
</td></tr>
<tr><td colspan="3"><input type="submit" value="Relate Other Object" name="findNewRelationship_pt:method">
|
|
From: <ssp...@us...> - 2003-07-03 18:05:11
|
Update of /cvsroot/zapp/ZApp/leverMethods/PG
In directory sc8-pr-cvs1:/tmp/cvs-serv18754/leverMethods/PG
Modified Files:
skinScriptLever.plain
Log Message:
fixed some ZApp bugs..
Index: skinScriptLever.plain
===================================================================
RCS file: /cvsroot/zapp/ZApp/leverMethods/PG/skinScriptLever.plain,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** skinScriptLever.plain 13 Jun 2003 13:59:53 -0000 1.6
--- skinScriptLever.plain 3 Jul 2003 18:05:07 -0000 1.7
***************
*** 40,44 ****
mode = item.get('mode','')
storeList.append(itemID)
! initList.append("%s=%s" % (itemID, `item.get('init_method',item.get('prop_default',''))`))
if (item['type'] == 'boolean') or (item.get('dbType','') == 'boolean'):
--- 40,44 ----
mode = item.get('mode','')
storeList.append(itemID)
! initList.append("%s=%s" % (itemID, item.get('init_method',`item.get('prop_default','')`)))
if (item['type'] == 'boolean') or (item.get('dbType','') == 'boolean'):
|
|
From: <ssp...@us...> - 2003-07-01 22:22:06
|
Update of /cvsroot/zapp/ZApp/zpt
In directory sc8-pr-cvs1:/tmp/cvs-serv20465/zpt
Added Files:
Generic_displayRelatedObjects.zpt findNewRelationship_ui.zpt
Removed Files:
Generic_displayRelatedObjects.py
Log Message:
added new relationship code..
--- NEW FILE: Generic_displayRelatedObjects.zpt ---
<div tal:define="app python:here.findApplication(); appURL app/absolute_url;
objRelations python:here.objectRelations( returnObjects=1 )">
<form action="" tal:attributes="action request/URL1" method="post">
<table >
<tr tal:condition="objRelations"><td> </td><td>Manager</td><td>ObjectID</td><td>Object Type</td><td>Context ID</td></tr>
<tr tal:condition="objRelations" tal:repeat="objRelation objRelations">
<input type="hidden" name="relationInfo.otherRIID:records" tal:attributes="value objRelation/otherRIID">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value objRelation/otherRIID"/></td>
<td tal:content="objRelation/otherManagerID"/>
<td><a tal:content="objRelation/otherObjectID" tal:attributes="href string:${objRelation/otherObject/absolute_url}/displayUpdateForm_html"/></td>
<td tal:content="objRelation/otherObject/objectType"/>
<td><input name="relationInfo.contextID:records" tal:attributes="value objRelation/otherContextID"/></td>
</tr>
<tr tal:condition="objRelations"><td colspan="3">
<input type="submit" value="Delete Relation" name="removeObjectRelations_ui:method">
<input tal:condition="objRelations" type="submit" value="Edit Selected Relations" name="editRelations_pt:method">
</td></tr>
<tr><td colspan="3"><input type="submit" value="Relate Other Object" name="findNewRelationship_pt:method">
</td></tr>
</table>
</form>
</div>
--- NEW FILE: findNewRelationship_ui.zpt ---
<h2 tal:content="string:${here/Manager} - ${here/id}" />
<form action="" tal:attributes="action request/URL1" method="post">
<table>
<tr><td>Object ID:</td><td> <input name="objectProperties.objectID:record"></td></tr>
<tr><td>Manager</td><td><select name="objectManager"><option value=""></option>
<span tal:repeat="managerID python:here.findSpecialistIDs()" tal:omit-tag="">
<option tal:attributes="value managerID" tal:content="managerID"/>
</span></select></td></tr>
<tr><td>Role</td><td> <input name="objectRole"></td></tr>
<input type="hidden" name="createIfNone:int" value="1">
<tr><td colspan="3"><input type="submit" value="Create Relationship" name="createAndAddObject_ui:method"></td></tr>
</table>
</form>
--- Generic_displayRelatedObjects.py DELETED ---
|
|
From: <ssp...@us...> - 2003-07-01 22:22:06
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv20465
Modified Files:
ZApp_RelatableItem.py ZApp_Relationship.py
ZApp_RelationshipManager.py
Log Message:
added new relationship code..
Index: ZApp_RelatableItem.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelatableItem.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ZApp_RelatableItem.py 2 Jun 2003 14:46:08 -0000 1.15
--- ZApp_RelatableItem.py 1 Jul 2003 22:22:03 -0000 1.16
***************
*** 8,11 ****
--- 8,12 ----
lprop = ZApp_Base.LeverProperty
+ from Products.PageTemplates.PageTemplateFile import PageTemplateFile
class ZApp_RelatableParentMixin:
***************
*** 246,251 ****
ZApp_Base.extendProperties( ZApp_RelatableItem, relatable_child_props )
- OVERRIDE = "This method should be overridden."
-
class ZApp_RelatedObject:
"""
--- 247,250 ----
***************
*** 257,260 ****
--- 256,262 ----
delete_if_orphaned = None
+ displayCustomUpdate_pt = PageTemplateFile('zpt/Generic_displayRelatedObjects', globals())
+ findNewRelationship_pt = PageTemplateFile('zpt/findNewRelationship_ui', globals())
+
_custom_skin_scripts=(
"WITH self.getObjectType() COMPUTE objectType=RESULT",
***************
*** 312,318 ****
theManager = self.getSpecialist( objectManager )
! newObject = theManager.ZApp_createNewItem( objectProperties )
! self.addObject( otherObject=newObject, objectRole=objectRole, selfRole=selfRole, createIfNone=createIfNone, contextID=contextID)
! return newObject
def addObject(self, otherObject, objectRole=None, selfRole=None, createIfNone=0, contextID=''):
--- 314,328 ----
theManager = self.getSpecialist( objectManager )
! theObject = None
!
! if objectProperties.has_key('objectID'):
! theObjectID = objectProperties.get('objectID','')
! if theObjectID:
! theObject = theManager.getItem( theObjectID)
!
! if not theObject:
! theObject = theManager.ZApp_createNewItem( objectProperties )
! self.addObject( otherObject=theObject, objectRole=objectRole, selfRole=selfRole, createIfNone=createIfNone, contextID=contextID)
! return theObject
def addObject(self, otherObject, objectRole=None, selfRole=None, createIfNone=0, contextID=''):
***************
*** 327,330 ****
--- 337,364 ----
rm.relateObjects( object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole, createIfNone=createIfNone, contextID=contextID)
+ def removeObjectRelations(self, relationshipIDs):
+ """
+ remove the relationships with the given relationship IDs..
+ """
+ self.getRelationshipManager().removeObjectRelations( relationshipIDs)
+
+ def removeObjectRelations_ui(self, relationshipIDs, REQUEST=None):
+ """
+ remove the relationships with the given relationship IDs.. + UI fluff..
+ """
+ if relationshipIDs:
+
+ self.removeObjectRelations( relationshipIDs )
+
+ if REQUEST is not None:
+ responseURL = self.REQUEST.get('responseURL',None)
+
+ if responseURL:
+ self.REQUEST.RESPONSE.redirect(responseURL)
+
+ return self.manage_main(self, REQUEST)
+ else:
+ raise RuntimeError, "I need some ids!"
+
def removeObject(self, otherObject=None, selfRole=None, objectRole=None):
"""
***************
*** 334,341 ****
rm = self.getRelationshipManager()
rm.removeObjects(object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole)
def relatedObjects(self, objectTypes=None, objectRoles=None, selfRoles=None):
"""
! Get related objects..
"""
if objectTypes:
--- 368,403 ----
rm = self.getRelationshipManager()
rm.removeObjects(object1=self, object1Role=selfRole, object2=otherObject, object2Role=objectRole)
+
+
+ def objectRelations(self, objectTypes=None, objectRoles=None, selfRoles=None, returnObjects=0):
+ """
+ Get info about the relationships in which I'm involved...
+
+ returns a list of dictionaries like so:
+ [
+ {'relationshipID':rid,
+ 'otherObjectID':objId,
+ 'otherManagerID':manID,
+ 'otherRole':otherRole,
+ 'selfRole':selfRole,
+ },
+ {....
+ },
+ ...
+ ]
+
+ if returnObjects is true, each dictionary also has 'otherObject':otherObject as a member.
+ """
+ if objectTypes:
+ if type(objectTypes) == type(''):
+ objectTypes = [objectTypes]
+
+ rm = self.getRelationshipManager()
+ return rm.getObjectRelations(anObject=self, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles, returnObjects=returnObjects)
+
def relatedObjects(self, objectTypes=None, objectRoles=None, selfRoles=None):
"""
! Get related objects themselves.
"""
if objectTypes:
***************
*** 358,362 ****
return rm.getRelatedObjectContextIDs( anObject=self, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles)
!
def nextContextID(self, objectTypes=None, objectRoles=None, selfRoles=None):
--- 420,451 ----
return rm.getRelatedObjectContextIDs( anObject=self, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles)
!
! def editRelations_ui(self, ids, relationInfo, REQUEST=None):
! """
! edit my relationships...
! """
!
! if not ids:
! raise RuntimeError, "No ids selected!"
!
! if not relationInfo:
! raise RuntimeError, "No relationship info provided.. "
!
! rItemMan = self.getRelationshipItemManager()
!
! for relInfo in relationInfo:
! otherRIID = relInfo.get('otherRIID','')
! if otherRIID in ids:
! rItem = rItemMan.getItem(otherRIID)
! if rItem:
! rItem.change( relInfo )
!
! if REQUEST is not None:
! responseURL = self.REQUEST.get('responseURL',None)
!
! if responseURL:
! self.REQUEST.RESPONSE.redirect(responseURL)
!
! return self.manage_main(self, REQUEST)
def nextContextID(self, objectTypes=None, objectRoles=None, selfRoles=None):
Index: ZApp_Relationship.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Relationship.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ZApp_Relationship.py 4 May 2003 03:47:54 -0000 1.4
--- ZApp_Relationship.py 1 Jul 2003 22:22:03 -0000 1.5
***************
*** 20,35 ****
meta_type = 'ZApp Relationship'
! def newRelationshipItem(self, conditions=None, **kw):
!
! if conditions == None:
! conditions = {}
!
! conditons.update(kw)
! conditons['relationshipID'] = self.id
!
! riH = self.getRelationshipItemHandler()
! newRI = riH.ZApp_createNewItem( conditions )
! return newRI
ZApp_Base.extendProperties( ZApp_Relationship, props )
--- 20,33 ----
meta_type = 'ZApp Relationship'
! 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: x.id not in excludeIDs, results)
! return results
ZApp_Base.extendProperties( ZApp_Relationship, props )
Index: ZApp_RelationshipManager.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipManager.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ZApp_RelationshipManager.py 30 Jun 2003 20:25:05 -0000 1.1
--- ZApp_RelationshipManager.py 1 Jul 2003 22:22:03 -0000 1.2
***************
*** 17,21 ****
meta_type = 'Z App Relationship Manager'
!
def relateObjects(self, object1, object2, object1Role=None, object2Role=None, createIfNone=0, contextID=''):
"""
--- 17,44 ----
meta_type = 'Z App Relationship Manager'
!
! def getRoleManager(self):
! """
! return the role object manager..
! """
! return getattr(self, rRolesID)
!
! def getRelationshipItemManager(self):
! """
! return the manager of relationship items..
! """
! 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=''):
"""
***************
*** 23,28 ****
"""
newR = self.ZApp_createNewItem()
! relIRolesMan = getattr(self, rRolesID)
! relItems = getattr(self, rItemsID)
role1ID=''
--- 46,51 ----
"""
newR = self.ZApp_createNewItem()
! relIRolesMan = self.getRoleManager()
! relItems = self.getRelationshipItemManager()
role1ID=''
***************
*** 42,51 ****
! rItem1 = getattr(self, rItemsID).ZApp_createNewItem(relationshipID=newR.id, objectID=object1.id, objectManager=object1.Manager, roleID=role1ID)
! rItem2 = getattr(self, rItemsID).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):
"""
! Relate two objects..
"""
role1ID=''
--- 65,84 ----
! 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 removeObjectRelations(self, relationshipIDs):
! """
! remove the relationships with the given relationship IDs..
! """
+ rItemsMan = self.getRelationshipItemManager()
+
+ for rItem in rItemsMan.ZApp_getItems( relationshipID = relationshipIDs):
+ rItem.manage_delete()
+
def removeObjects(self, object1, object2=None, object1Role=None, object2Role=None, object2Type=None, object2Manager=None):
"""
! Remove object relations between two objects..
"""
role1ID=''
***************
*** 64,68 ****
o2Manger=object2Manager
! relIRolesMan = getattr(self, rRolesID)
if object1Role:
--- 97,102 ----
o2Manger=object2Manager
! relIRolesMan = self.getRoleManager()
! rItemsMan = self.getRelationshipItemManager()
if object1Role:
***************
*** 75,81 ****
relationshipIDs = []
! for rItem1 in getattr(self, rItemsID).ZApp_getItems(objectID=object1.id, objectManager=object1.Manager, roleID=role1ID):
theRID=rItem1.relationshipID
! for rItem2 in getattr(self, rItemsID).ZApp_getItems(relationshipID=rItem1.relationshipID, objectManager=o2Manager, roleID=role2ID):
if (not ((rItem2.objectID == object1.id) and (rItem2.objectManager == object2.Manager))):
rItem2.manage_delete()
--- 109,115 ----
relationshipIDs = []
! for rItem1 in rItemsMan.ZApp_getItems(objectID=object1.id, objectManager=object1.Manager, roleID=role1ID):
theRID=rItem1.relationshipID
! for rItem2 in rItemsMan.ZApp_getItems(relationshipID=rItem1.relationshipID, objectManager=o2Manager, roleID=role2ID):
if (not ((rItem2.objectID == object1.id) and (rItem2.objectManager == object2.Manager))):
rItem2.manage_delete()
***************
*** 84,88 ****
self.commit_subtransaction()
! rItemsLeft = getattr(self, rItemsID).ZApp_getItems(relationshipID=theRID)
if len(rItemsLeft) < 2:
for ri in rItemsLeft:
--- 118,122 ----
self.commit_subtransaction()
! rItemsLeft = rItemsMan.ZApp_getItems(relationshipID=theRID)
if len(rItemsLeft) < 2:
for ri in rItemsLeft:
***************
*** 93,128 ****
relation.manage_delete()
! def getRelatedObjects(self, anObject, objectTypes=None, objectRoles=None, selfRoles=None):
"""
! find related objects... this is the 'brute force' approach.....
"""
! myRelationshipItems = getattr(self, rItemsID).ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
! riMan = getattr(self, rRolesID)
results = []
for anRI in myRelationshipItems:
! if selfRoles:
! RIRole = riMan.getItem(anRI.roleID)
! if (not RIRole) or (RIRole.name not in selfRoles):
! continue
- theRelationshipItems = getattr(self, rItemsID).ZApp_getItems( relationshipID=anRI.relationshipID )
for rItem in theRelationshipItems:
if objectRoles:
- RIRole = riMan.getItem(rItem.roleID)
if not RIRole:
continue
! elif RIRole.name not in objectRoles:
continue
! if (not ((rItem.objectManager == anObject.Manager) and (rItem.objectID == anObject.id))):
theObject = rItem.getObject()
! if objectTypes and (theObject.objectType not in objectTypes):
continue
! results.append(theObject)
return results
--- 127,218 ----
relation.manage_delete()
! def getObjectRelations(self, anObject, objectTypes=None, objectRoles=None, selfRoles=None, returnObjects=0):
"""
! get info about relationships in which anObject is involved..
!
! 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,
! },
! {....
! },
! ...
! ]
!
! if returnObjects is true, each dictionary also has 'otherObject':otherObject as a member.
!
"""
+ rItemsMan = self.getRelationshipItemManager()
! myRelationshipItems = rItemsMan.ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
! riMan = self.getRoleManager()
results = []
for anRI in myRelationshipItems:
! selfRIID= anRI.id
! selfRIRole = anRI.roleID and riMan.getItem(anRI.roleID)
! selfRIRoleName = (selfRIRole or '') and selfRIRole.name
! if selfRoles and (selfRIRoleName not in selfRoles):
! continue
!
! theRelationshipItems = rItemsMan.ZApp_getItems( relationshipID=anRI.relationshipID )
for rItem in theRelationshipItems:
+ if rItem.id == selfRIID:
+ continue # reject my own RI...
+
+ RIID = rItem.id
+ RIRole = rItem.roleID and riMan.getItem(rItem.roleID)
+ RIRoleName = (RIRole or '') and RIRole.name
if objectRoles:
if not RIRole:
continue
! elif RIRoleName not in objectRoles:
continue
! theResult = {}
!
! if objectTypes or returnObjects:
theObject = rItem.getObject()
! if objectTypes and theObject and (theObject.objectType not in objectTypes):
continue
! if returnObjects:
! theResult['otherObject'] = theObject
!
! theResult.update({
! 'relationshipID':rItem.relationshipID,
! 'otherRIID':RIID,
! 'otherObjectID':rItem.objectID,
! 'otherManagerID':rItem.objectManager,
! 'otherRole':RIRoleName,
! 'otherContextID':rItem.contextID,
! 'selfRole':selfRIRoleName,
! 'selfRIID':selfRIID,
! 'selfContextID':anRI.contextID,
! })
!
! results.append( theResult )
return results
+
+
+ def getRelatedObjects(self, anObject, objectTypes=None, objectRoles=None, selfRoles=None):
+ """
+ find related objects... this is the 'brute force' approach.....
+ """
+
+ results = self.getObjectRelations( anObject, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles, returnObjects=1)
+
+ return [x['otherObject'] for x in results]
***************
*** 132,137 ****
"""
! myRelationshipItems = getattr(self, rItemsID).ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
! riMan = getattr(self, rRolesID)
results = []
--- 222,227 ----
"""
! myRelationshipItems = self.getRelationshipItemManager().ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
! riMan = self.getRoleManager()
results = []
***************
*** 143,147 ****
continue
! theRelationshipItems = getattr(self, rItemsID).ZApp_getItems( relationshipID=anRI.relationshipID )
for rItem in theRelationshipItems:
if objectRoles:
--- 233,237 ----
continue
! theRelationshipItems = self.getRelationshipItemManager().ZApp_getItems( relationshipID=anRI.relationshipID )
for rItem in theRelationshipItems:
if objectRoles:
|
|
From: <ssp...@us...> - 2003-07-01 22:22:06
|
Update of /cvsroot/zapp/ZApp/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv20465/tests
Modified Files:
test_RelationsBase.py
Log Message:
added new relationship code..
Index: test_RelationsBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/tests/test_RelationsBase.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_RelationsBase.py 2 Jun 2003 16:41:38 -0000 1.8
--- test_RelationsBase.py 1 Jul 2003 22:22:03 -0000 1.9
***************
*** 82,85 ****
--- 82,121 ----
assert oToken(object2) in map(oToken, object1.relatedObjects())
+ def test_relateTwoObjects_getObjectRelations(self):
+
+ object1 = self.myApp.Foos.ZApp_createNewItem()
+ object2 = self.myApp.Bars.ZApp_createNewItem()
+
+ object1.addObject( object2 )
+
+ self.rm.commit_subtransaction()
+
+ result = None
+ for rDict in object1.objectRelations():
+ if rDict.get('otherObjectID','') == object2.id:
+ if rDict.get('otherManagerID','') == object2.Manager:
+ result = 1
+
+ assert result is not None
+
+ def test_deleteRelations(self):
+
+ object1 = self.myApp.Foos.ZApp_createNewItem()
+ object2 = self.myApp.Bars.ZApp_createNewItem()
+
+ object1.addObject( object2 )
+
+ self.rm.commit_subtransaction()
+
+ rIds = [x['relationshipID'] for x in object1.objectRelations()]
+
+ object1.removeObjectRelations( rIds )
+
+ self.rm.commit_subtransaction()
+
+ relations = object1.objectRelations()
+
+ assert len(relations) == 0
+
def test_relateTwoObjectsWithContextID(self):
|
|
From: <ssp...@us...> - 2003-06-30 20:25:08
|
Update of /cvsroot/zapp/ZApp/tests/import In directory sc8-pr-cvs1:/tmp/cvs-serv443/tests/import Modified Files: ZApp_TestApps.zexp Log Message: moved 'relationship manager' to a proper specialist. Index: ZApp_TestApps.zexp =================================================================== RCS file: /cvsroot/zapp/ZApp/tests/import/ZApp_TestApps.zexp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvs6lHLv3 and /tmp/cvsUN0056 differ |