zapp-cvs-commit Mailing List for ZApp Framework (Page 9)
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-06-30 20:25:08
|
Update of /cvsroot/zapp/ZApp/zpt
In directory sc8-pr-cvs1:/tmp/cvs-serv443/zpt
Added Files:
Generic_createNewRelationshipForm.zpt
Generic_displayRelatedObjects.py Generic_mainTemplate.zpt
Log Message:
moved 'relationship manager' to a proper specialist.
--- NEW FILE: Generic_createNewRelationshipForm.zpt ---
<html metal:use-macro="here/mainTemplate_pt/macros/main">
<body>
<span metal:fill-slot="main_body">
<form action="findPersonToAdd_ui" method="post">
<table>
<tr><td align="center">Search for Existing Person To Relate</td></tr>
<tr>
<td>First Name:</td>
<td><input name="first" value=""></td>
</tr>
<tr>
<td>Middle Name:</td>
<td><input name="middle" value=""></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input name="last" value=""></td>
</tr>
<tr><td colspan="2" align="center"><input type="submit" value="Find"></td></tr>
</table>
</form>
</span>
</body>
</html>
--- NEW FILE: Generic_displayRelatedObjects.py ---
<div tal:define="app python:here.findApplication(); appURL app/absolute_url;
addresses python:app.Addresses.getAddressesForOwner( ownerID = here.id )">
<form action="" tal:attributes="action request/URL1" method="post">
<table >
<tr tal:condition="addresses"><td> </td><td>AddressID</td><td>Street Address</td><td> City </td><td> State </td><td> Postal Code </td><td> Phone</td></tr>
<tr tal:condition="addresses" tal:repeat="address addresses">
<td><input name="ids:list" type=checkbox value="" tal:attributes="value address/id"/></td>
<td><a tal:content="address/id" tal:attributes="href string:${appURL}/Addresses/${address/id}/displayUpdateForm_html"/></td>
<td tal:content="address/streetAddress"></td>
<td><span tal:replace="address/city"/></td>
<td><span tal:replace="address/state"/></td>
<td><span tal:replace="address/postalCode"/></td>
<td><span tal:replace="address/phone"/></td>
</tr>
<tr tal:condition="addresses"><td colspan="3"><input type="submit" value="Delete Address" name="deleteAddressFromObject_ui:method"></td></tr>
<tr><td colspan="3"><input type="submit" value="Add New Addresss" name="addAddressToObject_ui:method"></td></tr>
</table>
</form>
</div>
--- NEW FILE: Generic_mainTemplate.zpt ---
<html metal:define-macro="main">
<head metal:define-slot="header">
<title>Person Info</title>
</head>
<body>
<span metal:define-slot="main_body">Here is the main body... </span>
<div metal:define-slot="footer">
<p><span tal:replace="structure here/ZopeAttributionButton"/></p>
</div>
</body>
</html>
|
|
From: <ssp...@us...> - 2003-06-30 20:25:08
|
Update of /cvsroot/zapp/ZApp/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv443/tests
Modified Files:
test_MiscDataUserBase.py
Log Message:
moved 'relationship manager' to a proper specialist.
Index: test_MiscDataUserBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/tests/test_MiscDataUserBase.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_MiscDataUserBase.py 18 Jun 2003 19:11:19 -0000 1.3
--- test_MiscDataUserBase.py 30 Jun 2003 20:25:05 -0000 1.4
***************
*** 66,75 ****
assert object1.prop1 == testString
except:
! import pdb
! pdb.set_trace()
!
! object1.propertysheets.get('testProps').manage_changeProperties( prop1 = testString)
!
!
if __name__=='__main__':
--- 66,74 ----
assert object1.prop1 == testString
except:
! if 0:
! import pdb
! pdb.set_trace()
! object1.propertysheets.get('testProps').manage_changeProperties( prop1 = testString)
! raise
if __name__=='__main__':
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv443
Modified Files:
ZApp_Application.py ZApp_RelationshipManagerMixin.py
ZApp_Specialist.py __init__.py addZApp_SpecialistForm.dtml
Added Files:
ZApp_RelationshipManager.py
Log Message:
moved 'relationship manager' to a proper specialist.
--- NEW FILE: ZApp_RelationshipManager.py ---
import ZApp_Specialist
import string
from Globals import DTMLFile, MessageDialog, default__class_init__
from Products.PlugIns import PlugInFinder
from Products.ZPatterns.Specialists import Specialist
rManID = 'Relationships'
rItemsID = 'RelationshipItems'
rRolesID = 'RelationshipRoles'
class ZApp_RelationshipManager(ZApp_Specialist.ZApp_Specialist):
"""
This Specialist provides methods for a 'relationshipmanger' to handle
creation/destruction/discovery of relationships.
"""
meta_type = 'Z App Relationship Manager'
def relateObjects(self, object1, object2, object1Role=None, object2Role=None, createIfNone=0, contextID=''):
"""
Relate two objects..
"""
newR = self.ZApp_createNewItem()
relIRolesMan = getattr(self, rRolesID)
relItems = getattr(self, rItemsID)
role1ID=''
role2ID=''
if object1Role:
role1IDs = relIRolesMan.ZApp_getItemIds( name=object1Role, objectType=object1.objectType, relatedObjectType=object2.objectType, createIfNone=createIfNone)
role1ID = role1IDs and role1IDs[0]
if not role1ID:
raise RuntimeError, ("No such role '%s'" % object1Role)
if object2Role:
role2IDs = relIRolesMan.ZApp_getItemIds( name=object2Role, objectType=object2.objectType, relatedObjectType=object1.objectType, createIfNone=createIfNone)
role2ID = role2IDs and role2IDs[0]
if not role2ID:
raise RuntimeError, ("No such role '%s'" % object2Role)
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=''
role2ID=''
o2Type=''
if object2:
o2Type=object2.objectType
elif object2Type:
o2Type=object2Type
o2Manager=''
if object2:
o2Manager=object2.Manager
elif object2Manager:
o2Manger=object2Manager
relIRolesMan = getattr(self, rRolesID)
if object1Role:
role1IDs = relIRolesMan.ZApp_getItemIds( name=object1Role, objectType=object1.objectType, relatedObjectType=o2Type)
role1ID = role1IDs and role1IDs[0]
if object2Role:
role2IDs = relIRolesMan.ZApp_getItemIds( name=object2Role, objectType=o2Type, relatedObjectType=object1.objectType)
role2ID = role2IDs and role2IDs[0]
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()
rItem1.manage_delete()
self.commit_subtransaction()
rItemsLeft = getattr(self, rItemsID).ZApp_getItems(relationshipID=theRID)
if len(rItemsLeft) < 2:
for ri in rItemsLeft:
ri.manage_delete()
relation = self.getItem(theRID)
if relation:
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
def getRelatedObjectContextIDs(self, anObject, objectTypes=None, objectRoles=None, selfRoles=None, returnTuple=0):
"""
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))):
if objectTypes and (theObject.objectType not in objectTypes):
continue
results.append((rItem.getSortableContextID(), rItem.contextID)) # build a sortable list...
results.sort()
if not returnTuple:
results = map(lambda x:x[1], results) # grab the actual context id...
return results
def nextContextID(self, anObject, objectTypes=None, objectRoles=None, selfRoles=None):
"""
get the 'next' contextID that makes sense..
"""
contextIDs = self.getRelatedObjectContextIDs( anObject, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles, returnTuple=1)
maxVal = contextIDs and contextIDs[-1][0]
iVal = 1
if maxVal:
try:
iVal = string.atoi(maxVal) + 1
except ValueError:
try:
iVal = chr(ord(maxVal) + 1)
except ValueError:
pass
else:
pass
return iVal
def manage_addZApp_RelationshipManager(self, id=rManID, title='', rack='', leverSet='', REQUEST=None, lsmID=ZApp_Specialist.DEFAULT_LEVER_SET_ID):
"""
Add a RelationshipManager to this applicaton..
"""
ob = ZApp_Specialist.manage_addZApp_Specialist(self, id, title,
rack=rack,
leverSet=leverSet,
REQUEST=REQUEST,
lsmID=lsmID,
subClass=ZApp_RelationshipManager)
ZApp_Specialist.manage_addZApp_Specialist(ob, rItemsID,'',rack,leverSet,lsmID) # add the RelationshipItems Manager
ZApp_Specialist.manage_addZApp_Specialist(ob, rRolesID,'',rack,leverSet,lsmID) # add the RelationshipRoles Manager
rItems = getattr(ob, rItemsID)
rRoles = getattr(ob, rRolesID)
if (leverSet == 'ZODB_Lever_Methods'):
rItems.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_RelationshipItem/ZApp_RelationshipItem', use_attrib='NO', load_attrib='')
rRoles.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_Role/ZApp_RelationshipItemRole', use_attrib='NO', load_attrib='')
ob.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_Relationship/ZApp_Relationship', use_attrib="NO", load_attrib='')
else:
rItems.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_RelationshipItem/ZApp_RelationshipItem', use_attrib='YES', load_attrib='relationshipItemID')
rRoles.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_Role/ZApp_RelationshipItemRole', use_attrib='YES', load_attrib='relationshipRoleID')
ob.defaultRack.manage_setStorage(zclass='Products.ZApp.ZApp_Relationship/ZApp_Relationship', use_attrib="YES", load_attrib='relationshipID')
if self.hasProperty('specialistMetaTypes'):
theApp = self
else:
theApp = self.findApplication()
oldList = theApp.specialistMetaTypes
if ZApp_RelationshipManager.meta_type not in oldList:
theApp.manage_changeProperties( specialistMetaTypes = oldList + [ZApp_RelationshipManager.meta_type])
if REQUEST:
return self.manage_main(self,REQUEST,update_menu=1)
ZApp_Specialist.setupClassInit(subClass=ZApp_RelationshipManager)
manage_addZApp_RelationshipManagerForm = DTMLFile('addZApp_SpecialistForm',
globals(),
RacksMetaTypes = PlugInFinder(Specialist.RacksGroup),
ZApp_Specialist_SubclassID=rManID,
ZApp_subClass_addMethod='manage_addZApp_RelationshipManager',
)
def initialize(context):
ZApp_Specialist.initialize(context,
subClass=ZApp_RelationshipManager,
addMethod=manage_addZApp_RelationshipManager,
addForm=manage_addZApp_RelationshipManagerForm)
Index: ZApp_Application.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Application.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** ZApp_Application.py 7 May 2003 01:29:12 -0000 1.19
--- ZApp_Application.py 30 Jun 2003 20:25:05 -0000 1.20
***************
*** 18,22 ****
from Products.PlugIns import PlugInContainer, PlugInFinder, PlugInGroup, MakePICBase
from Products.ZApp.ZApp_Specialist import DEFAULT_LEVER_SET_ID
- from ZApp_RelationshipManagerMixin import ZApp_RelationshipManagerMixin
from ComputedAttribute import ComputedAttribute
--- 18,21 ----
***************
*** 119,123 ****
return MessageDialog(title='OK', message = ' Added ZApp Application ', action='manage_main')
! class ZApp_Application( PlugInContainer, ZApp_RelationshipManagerMixin ):
applicationMetaType = meta_type = 'Z App Application'
--- 118,125 ----
return MessageDialog(title='OK', message = ' Added ZApp Application ', action='manage_main')
!
! from ZApp_RelationshipManager import rManID
!
! class ZApp_Application( PlugInContainer):
applicationMetaType = meta_type = 'Z App Application'
***************
*** 212,215 ****
--- 214,224 ----
theSpecialistPath = '%s' % '/'.join(specCache.get(specName,None))
return self.restrictedTraverse( theSpecialistPath )
+
+ def getRelationshipManager(self):
+ """
+ get the application's "RelationshipManager".
+ """
+
+ return self.getSpecialist(rManID)
def getSpecialistsCache(self):
Index: ZApp_RelationshipManagerMixin.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_RelationshipManagerMixin.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ZApp_RelationshipManagerMixin.py 2 Jun 2003 14:46:08 -0000 1.3
--- ZApp_RelationshipManagerMixin.py 30 Jun 2003 20:25:05 -0000 1.4
***************
*** 1,176 ****
- """
- This module provides methods for a 'relationshipmanger' to handle creation/destruction/discovery of relationships.
- """
-
- import string
-
- class ZApp_RelationshipManagerMixin:
-
- def relateObjects(self, relMan, object1, object2, object1Role=None, object2Role=None, createIfNone=0, contextID=''):
- """
- Relate two objects..
- """
- newR = relMan.ZApp_createNewItem()
- relIRolesMan = relMan.RelationshipRoles
- relItems = relMan.RelationshipItems
-
- role1ID=''
- role2ID=''
-
- if object1Role:
- role1IDs = relIRolesMan.ZApp_getItemIds( name=object1Role, objectType=object1.objectType, relatedObjectType=object2.objectType, createIfNone=createIfNone)
- role1ID = role1IDs and role1IDs[0]
- if not role1ID:
- raise RuntimeError, ("No such role '%s'" % object1Role)
-
- if object2Role:
- role2IDs = relIRolesMan.ZApp_getItemIds( name=object2Role, objectType=object2.objectType, relatedObjectType=object1.objectType, createIfNone=createIfNone)
- role2ID = role2IDs and role2IDs[0]
- if not role2ID:
- raise RuntimeError, ("No such role '%s'" % object2Role)
-
-
- rItem1 = relMan.RelationshipItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object1.id, objectManager=object1.Manager, roleID=role1ID)
- rItem2 = relMan.RelationshipItems.ZApp_createNewItem(relationshipID=newR.id, objectID=object2.id, objectManager=object2.Manager, roleID=role2ID, contextID=contextID)
-
- def removeObjects(self, relMan, object1, object2=None, object1Role=None, object2Role=None, object2Type=None, object2Manager=None):
- """
- Relate two objects..
- """
- role1ID=''
- role2ID=''
-
- o2Type=''
- if object2:
- o2Type=object2.objectType
- elif object2Type:
- o2Type=object2Type
-
- o2Manager=''
- if object2:
- o2Manager=object2.Manager
- elif object2Manager:
- o2Manger=object2Manager
-
- if object1Role:
- role1IDs = relIRolesMan.ZApp_getItemIds( name=object1Role, objectType=object1.objectType, relatedObjectType=o2Type)
- role1ID = role1IDs and role1IDs[0]
-
- if object2Role:
- role2IDs = relIRolesMan.ZApp_getItemIds( name=object2Role, objectType=o2Type, relatedObjectType=object1.objectType)
- role2ID = role2IDs and role2IDs[0]
-
- relationshipIDs = []
- for rItem1 in relMan.RelationshipItems.ZApp_getItems(objectID=object1.id, objectManager=object1.Manager, roleID=role1ID):
- theRID=rItem1.relationshipID
- for rItem2 in relMan.RelationshipItems.ZApp_getItems(relationshipID=rItem1.relationshipID, objectManager=o2Manager, roleID=role2ID):
- if (not ((rItem2.objectID == object1.id) and (rItem2.objectManager == object2.Manager))):
-
- rItem2.manage_delete()
- rItem1.manage_delete()
-
- relMan.commit_subtransaction()
-
- rItemsLeft = relMan.RelationshipItems.ZApp_getItems(relationshipID=theRID)
- if len(rItemsLeft) < 2:
- for ri in rItemsLeft:
- ri.manage_delete()
-
- relation = relMan.getItem(theRID)
- if relation:
- relation.manage_delete()
-
- def getRelatedObjects(self, relMan, anObject, objectTypes=None, objectRoles=None, selfRoles=None):
- """
- find related objects... this is the 'brute force' approach.....
- """
-
- myRelationshipItems = relMan.RelationshipItems.ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
- riMan = relMan.RelationshipRoles
-
- results = []
-
- for anRI in myRelationshipItems:
- if selfRoles:
- RIRole = riMan.getItem(anRI.roleID)
- if (not RIRole) or (RIRole.name not in selfRoles):
- continue
-
- theRelationshipItems = relMan.RelationshipItems.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
-
-
- def getRelatedObjectContextIDs(self, relMan, anObject, objectTypes=None, objectRoles=None, selfRoles=None, returnTuple=0):
- """
- find related objects... this is the 'brute force' approach.....
- """
-
- myRelationshipItems = relMan.RelationshipItems.ZApp_getItems( objectID=anObject.id, objectManager=anObject.Manager)
- riMan = relMan.RelationshipRoles
-
- results = []
-
- for anRI in myRelationshipItems:
- if selfRoles:
- RIRole = riMan.getItem(anRI.roleID)
- if (not RIRole) or (RIRole.name not in selfRoles):
- continue
-
- theRelationshipItems = relMan.RelationshipItems.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))):
- if objectTypes and (theObject.objectType not in objectTypes):
- continue
- results.append((rItem.getSortableContextID(), rItem.contextID)) # build a sortable list...
-
- results.sort()
-
- if not returnTuple:
- results = map(lambda x:x[1], results) # grab the actual context id...
-
- return results
-
- def nextContextID(self, relMan, anObject, objectTypes=None, objectRoles=None, selfRoles=None):
- """
- get the 'next' contextID that makes sense..
- """
-
- contextIDs = self.getRelatedObjectContextIDs( relMan, anObject, objectTypes=objectTypes, objectRoles=objectRoles, selfRoles=selfRoles, returnTuple=1)
-
- maxVal = contextIDs and contextIDs[-1][0]
-
- iVal = 1
- if maxVal:
- try:
- iVal = string.atoi(maxVal) + 1
- except ValueError:
- try:
- iVal = chr(ord(maxVal) + 1)
- except ValueError:
- pass
- else:
- pass
-
- return iVal
-
--- 0 ----
Index: ZApp_Specialist.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Specialist.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** ZApp_Specialist.py 25 Jun 2003 11:45:53 -0000 1.27
--- ZApp_Specialist.py 30 Jun 2003 20:25:05 -0000 1.28
***************
*** 17,22 ****
DEFAULT_LEVER_SET_ID='defaultLeverSet'
- # from ZApp_LeverMethods import ZApp_LeverMethodSets why??
-
commit_mode = 0 # should we force a commit immediately after structural changes?
--- 17,20 ----
***************
*** 99,125 ****
UIDGen = UniqueIDGenerator()
- def manage_addZApp_Specialist(self, id, title='', rack='', leverSet='', REQUEST=None, URL1='Youre_lost', lsmID=DEFAULT_LEVER_SET_ID):
- '''
- Adds a ZApp Specialist to the current folder.
- '''
-
- ob = ZApp_Specialist(id, title)
- self._setObject(id, ob)
- ob = ob.__of__(self)
-
- if rack:
- ob.RacksGroup._constructPlugIn(rack, id='defaultRack')
-
- if leverSet:
- ob.LeversSetsGroup._constructPlugIn("ZApp Lever Method Sets", id=lsmID)
- lsm = getattr(ob, lsmID, '')
- lsm and lsm.manage_changeProperties(myLeverSet=leverSet)
-
- ob.LeversSetsGroup._constructPlugIn("ZApp Lever Method Sets", id='genericLeverSet')
- lsm = getattr(ob, 'genericLeverSet', '')
- lsm and lsm.manage_changeProperties(myLeverSet='genericLevers')
-
- if REQUEST: return self.manage_main(self,REQUEST,update_menu=1)
-
from Products.PlugIns import PlugInGroup, PlugInContainer, PlugInFinder, MakePICBase
--- 97,100 ----
***************
*** 274,278 ****
return Results((items, data))
! def ZApp_insertNewItem(self, conditions=None, **kw):
"""
This method circumvents all the Specialist, Rack, Dataskin,
--- 249,253 ----
return Results((items, data))
! def ZApp_insertNewItem(self, conditions=None, displayQuery=None, **kw):
"""
This method circumvents all the Specialist, Rack, Dataskin,
***************
*** 294,298 ****
for prop in pm:
! props[prop['id']] = prop.get('sqlDefault',prop.get('prop_default',''))
if conditions:
--- 269,273 ----
for prop in pm:
! props[prop['id']] = prop.get('dbDefault',prop.get('prop_default',''))
if conditions:
***************
*** 301,305 ****
if kw:
props.update(kw.copy())
!
self.insertItem( REQUEST=props )
self._toCache( newID, self.ZApp_createFauxResult( props ))
--- 276,283 ----
if kw:
props.update(kw.copy())
!
! if displayQuery:
! return self.insertItem( REQUEST=props, src__=1 )
!
self.insertItem( REQUEST=props )
self._toCache( newID, self.ZApp_createFauxResult( props ))
***************
*** 315,324 ****
if properties is None:
! kw.update(self.REQUEST.form)
! else:
! kw.update(properties)
! if kw:
! newItem.change(kw)
return newItem
--- 293,306 ----
if properties is None:
! properties = {}
! properties.update(kw)
!
! if not properties:
! properties.update(self.REQUEST.form)
! properties.update(self.REQUEST.other)
!
! if properties:
! newItem.change(properties)
return newItem
***************
*** 367,370 ****
--- 349,387 ----
return "OK!"
+ def ZApp_getDefaultDictionary(self, typeString=0):
+ """
+ return a dictionary with default values for each property...
+
+ if typeString is 'true' the value of each item will be an appropriate type string
+ """
+ dict = {}
+
+ pm = self.ZApp_getPropertyMap()
+
+ if typeString:
+ newPM = []
+ for i in range(len(pm)):
+ item = {}
+ newPM.append(item)
+ item.update(pm[i])
+ itemType = type(item['prop_default'])
+ if itemType == type(''):
+ item['prop_default'] = '%(' + item['id']+ ')s'
+ elif itemType == type(0):
+ item['prop_default'] = '%(' + item['id'] + ')i'
+ elif itemType == type(1.0):
+ item['prop_default'] = '%(' + item['id'] + ')f'
+ pm = tuple(newPM)
+
+ [dict.setdefault(x['id'],x['prop_default']) for x in pm]
+ pk = self.getPrimaryKey()
+
+ if typeString:
+ dict[pk]='%(' + pk + ')s'
+ else:
+ dict[pk]=''
+
+ return dict
+
def ZApp_getPropertyMap(self):
"""
***************
*** 480,489 ****
if conditions is None:
! if not kw:
! conditions = self.REQUEST
! else:
! conditions = kw
! else:
! conditions.update(kw)
if displayQuery:
--- 497,507 ----
if conditions is None:
! conditions = {}
!
! conditions.update(kw)
!
! if not conditions:
! conditions.update(getattr(self.REQUEST,'form',{}))
! conditions.update(getattr(self.REQUEST,'other',{}))
if displayQuery:
***************
*** 563,572 ****
theIDs = []
- if kw:
- conditions = kw.copy()
-
if conditions is None:
try:
! conditions = self.REQUEST.form.copy()
conditions.update(self.REQUEST.other)
except:
--- 581,592 ----
theIDs = []
if conditions is None:
+ conditions = {}
+
+ conditions.update(kw)
+
+ if not conditions:
try:
! conditions.update(self.REQUEST.form)
conditions.update(self.REQUEST.other)
except:
***************
*** 658,672 ****
)
- default__class_init__(ZApp_Specialist); MakePICBase(ZApp_Specialist)
! def initialize(context):
context.registerClass(
! ZApp_Specialist,
permission = 'Add ZApp Specialists',
! constructors = (manage_addZApp_SpecialistForm,
! manage_addZApp_Specialist)
)
! context.registerPIContainerBase(ZApp_Specialist)
--- 678,728 ----
)
! def setupClassInit(subClass = ZApp_Specialist):
! default__class_init__(subClass)
! MakePICBase(subClass)
!
! setupClassInit()
!
! def manage_addZApp_Specialist(self, id, title='', rack='', leverSet='', REQUEST=None, URL1='Youre_lost', lsmID=DEFAULT_LEVER_SET_ID, subClass=ZApp_Specialist):
! '''
! Adds a ZApp Specialist (or a subClass) to the current folder.
!
! if this method is used to build a subClass (i.e., subClass is not ZApp_Specialist) then the
! created object is also returned..
!
! '''
!
! ob = subClass(id, title)
! self._setObject(id, ob)
! ob = ob.__of__(self)
!
! if rack:
! ob.RacksGroup._constructPlugIn(rack, id='defaultRack')
!
! if leverSet:
! ob.LeversSetsGroup._constructPlugIn("ZApp Lever Method Sets", id=lsmID)
! lsm = getattr(ob, lsmID, '')
! lsm and lsm.manage_changeProperties(myLeverSet=leverSet)
!
! ob.LeversSetsGroup._constructPlugIn("ZApp Lever Method Sets", id='genericLeverSet')
! lsm = getattr(ob, 'genericLeverSet', '')
! lsm and lsm.manage_changeProperties(myLeverSet='genericLevers')
!
! if subClass != ZApp_Specialist:
! return ob
!
! if REQUEST:
! 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(
! subClass,
permission = 'Add ZApp Specialists',
! constructors = (addForm,
! addMethod)
)
! context.registerPIContainerBase(subClass)
Index: __init__.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/__init__.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** __init__.py 25 Jun 2003 11:45:53 -0000 1.14
--- __init__.py 30 Jun 2003 20:25:05 -0000 1.15
***************
*** 13,16 ****
--- 13,17 ----
import ZApp_MiscData
import ZApp_Utils
+ import ZApp_RelationshipManager
from ZApp_LOG import ZApp_LOG
***************
*** 57,61 ****
ZApp_Application.initialize(context)
ZApp_LeverMethods.initialize(context)
! ZApp_MiscData.initialize(context)
context.registerHelp()
--- 58,63 ----
ZApp_Application.initialize(context)
ZApp_LeverMethods.initialize(context)
! ZApp_MiscData.initialize(context)
! ZApp_RelationshipManager.initialize(context)
context.registerHelp()
Index: addZApp_SpecialistForm.dtml
===================================================================
RCS file: /cvsroot/zapp/ZApp/addZApp_SpecialistForm.dtml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** addZApp_SpecialistForm.dtml 2 Mar 2003 19:23:25 -0000 1.2
--- addZApp_SpecialistForm.dtml 30 Jun 2003 20:25:05 -0000 1.3
***************
*** 5,9 ****
)">
! <FORM ACTION="manage_addZApp_Specialist" METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
--- 5,9 ----
)">
! <FORM ACTION="." METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
***************
*** 12,16 ****
--- 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>
***************
*** 51,55 ****
<TD></TD>
<TD>
! <INPUT class="form-element" TYPE="SUBMIT" VALUE=" Add ">
</TD>
</TR>
--- 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>
|
|
From: <ssp...@us...> - 2003-06-30 20:18:53
|
Update of /cvsroot/zapp/ZApp/zpt In directory sc8-pr-cvs1:/tmp/cvs-serv32008/zpt Log Message: Directory /cvsroot/zapp/ZApp/zpt added to the repository |
|
From: <ssp...@us...> - 2003-06-26 15:18:55
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv29458
Modified Files:
ZApp_CMFBase.py
Log Message:
save cmf changes..
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ZApp_CMFBase.py 25 Jun 2003 16:31:18 -0000 1.9
--- ZApp_CMFBase.py 26 Jun 2003 15:18:52 -0000 1.10
***************
*** 63,69 ****
def addZAppCMFObject(self, id, title='', klass=ZApp_CMFBase, useExisting=1):
- #import pdb
- #pdb.set_trace()
-
#
# since we're a FreeRangeDataSkin.. we can get our data manager here..
--- 63,66 ----
***************
*** 96,99 ****
--- 93,99 ----
initCMFObjectMetadata(o)
o.change()
+
+ if klass != ZApp_CMFBase:
+ return o
from DateTime import DateTime
***************
*** 112,118 ****
factory_type_information = (
! {'id': 'ZAppCMFContent',
! 'title':'ZApp CMF Content Type',
! 'meta_type' : 'ZApp CMF Content Type',
'product': 'ZApp',
'description':'Content type based on ZApp objects',
--- 112,162 ----
factory_type_information = (
! {'id': 'ZApp CMF Image',
! 'title':'',
! 'meta_type' : 'ZApp CMF Image',
! 'product': 'ZApp',
! 'description':'Image Content type based on ZApp objects',
! 'icon':'image_icon.gif',
! 'factory': 'addZAppCMFObject',
! 'immediate_view': 'zapp_image_edit_form',
! 'actions': ({'id': 'view',
! 'name': 'View',
! 'action': 'zapp_image_view',
! 'permissions': (CMFCorePermissions.View,)},
! {'id': 'edit',
! 'name': 'Edit',
! 'action': 'zapp_image_edit_form',
! 'permissions': (CMFCorePermissions.ModifyPortalContent,)},
! { 'id' : 'metadata'
! , 'name' : 'Metadata'
! , 'action': 'string:${object_url}/metadata_edit_form'
! , 'permissions' : (CMFCorePermissions.ModifyPortalContent,)},
! ),
! },
! {'id': 'ZApp CMF File',
! 'title':'',
! 'meta_type' : 'ZApp CMF File',
! 'product': 'ZApp',
! 'description':'File Content type based on ZApp objects',
! 'icon':'file_icon.gif',
! 'factory': 'addZAppCMFObject',
! 'immediate_view': 'zapp_file_edit_form',
! 'actions': ({'id': 'view',
! 'name': 'View',
! 'action': 'zapp_file_view',
! 'permissions': (CMFCorePermissions.View,)},
! {'id': 'edit',
! 'name': 'Edit',
! 'action': 'zapp_file_edit_form',
! 'permissions': (CMFCorePermissions.ModifyPortalContent,)},
! { 'id' : 'metadata'
! , 'name' : 'Metadata'
! , 'action': 'string:${object_url}/metadata_edit_form'
! , 'permissions' : (CMFCorePermissions.ModifyPortalContent,)},
! ),
! },
! {'id': 'ZApp CMF Content',
! 'title':'',
! 'meta_type' : 'ZApp CMF Content',
'product': 'ZApp',
'description':'Content type based on ZApp objects',
***************
*** 126,141 ****
{'id': 'edit',
'name': 'Edit',
- 'action': 'zapp_cmf_object_view',
- 'permissions': (CMFCorePermissions.View,)},
- {'id': 'editType',
- 'name': 'EditType',
'action': 'zapp_cmf_object_edit_form',
! 'permissions': (CMFCorePermissions.ManagerPortalContent,)},
! )
{'id': 'editType',
'name': 'EditType',
'action': 'zapp_cmf_object_type_edit_form',
! 'permissions': (CMFCorePermissions.ManagerPortal,)},
! )
},
)
--- 170,184 ----
{'id': 'edit',
'name': 'Edit',
'action': 'zapp_cmf_object_edit_form',
! 'permissions': (CMFCorePermissions.ModifyPortalContent,)},
{'id': 'editType',
'name': 'EditType',
'action': 'zapp_cmf_object_type_edit_form',
! 'permissions': (CMFCorePermissions.ManagePortal,)},
! { 'id' : 'metadata'
! , 'name' : 'Metadata'
! , 'action': 'string:${object_url}/metadata_edit_form'
! , 'permissions' : (CMFCorePermissions.ModifyPortalContent,)},
! ),
},
)
|
|
From: <ssp...@us...> - 2003-06-25 16:31:22
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic In directory sc8-pr-cvs1:/tmp/cvs-serv29758/skins/zapp_generic Added Files: zapp_get_object_info.py Log Message: added all edit methods to factory type info.. --- NEW FILE: zapp_get_object_info.py --- # Example code: return context.safeMiscData.getXMLDict() |
|
From: <ssp...@us...> - 2003-06-25 16:31:22
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv29758
Modified Files:
ZApp_CMFBase.py
Log Message:
added all edit methods to factory type info..
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ZApp_CMFBase.py 25 Jun 2003 11:45:53 -0000 1.8
--- ZApp_CMFBase.py 25 Jun 2003 16:31:18 -0000 1.9
***************
*** 124,127 ****
--- 124,140 ----
'action': 'zapp_cmf_object_view',
'permissions': (CMFCorePermissions.View,)},
+ {'id': 'edit',
+ 'name': 'Edit',
+ 'action': 'zapp_cmf_object_view',
+ 'permissions': (CMFCorePermissions.View,)},
+ {'id': 'editType',
+ 'name': 'EditType',
+ 'action': 'zapp_cmf_object_edit_form',
+ 'permissions': (CMFCorePermissions.ManagerPortalContent,)},
+ )
+ {'id': 'editType',
+ 'name': 'EditType',
+ 'action': 'zapp_cmf_object_type_edit_form',
+ 'permissions': (CMFCorePermissions.ManagerPortal,)},
)
},
|
|
From: <ssp...@us...> - 2003-06-25 15:47:35
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv23161
Modified Files:
ZApp_Base.py
Log Message:
fixed app meta-type check..
Index: ZApp_Base.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Base.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** ZApp_Base.py 25 Jun 2003 11:45:53 -0000 1.19
--- ZApp_Base.py 25 Jun 2003 15:47:30 -0000 1.20
***************
*** 233,242 ****
currObject = self
!
while 1:
if (not currObject) or (not hasattr(currObject, 'meta_type')):
raise RuntimeError, "Hmm. thaf's odd.. I can't find any ZApp Application here!"
! if currObject.meta_type == ZApp_Application.ZApp_Application.meta_type:
break
--- 233,242 ----
currObject = self
!
while 1:
if (not currObject) or (not hasattr(currObject, 'meta_type')):
raise RuntimeError, "Hmm. thaf's odd.. I can't find any ZApp Application here!"
! if currObject.meta_type == self.applicationMetaType:
break
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic
In directory sc8-pr-cvs1:/tmp/cvs-serv14999/skins/zapp_generic
Added Files:
clearStack.py getApplication.py getCurrentStack.py
getSessionValue.py getTopNamespace.py guess_type.py
manage_edit_stack_levels.py manage_session_stack.pt
popStateInfo.py pushStateInfo.py setCurrentStack.py
setSessionValues.py setupRequest.py zapp_cmf_object_edit.py
zapp_cmf_object_edit_form.pt zapp_cmf_object_get_info.py
zapp_cmf_object_type_edit.py zapp_cmf_object_type_edit_form.pt
zapp_cmf_object_view.pt zapp_file_edit.py
zapp_file_edit_form.pt zapp_file_view.pt zapp_get_fileObj.py
zapp_image_edit.py zapp_image_edit_form.pt zapp_image_view.pt
Log Message:
added some skins to ZApp CMF core..
--- NEW FILE: clearStack.py ---
## Script (Python) "clearStack"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
context.setCurrentStack([{}])
return 'OK!'
--- NEW FILE: getApplication.py ---
## Script (Python) "getApplication"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
return getattr(context, getattr(context, 'hec_app_id', 'HTheatre'))
--- NEW FILE: getCurrentStack.py ---
## Script (Python) "getCurrentStack"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Get the Current Stack
##
sessionID = context.browser_id_manager.getBrowserId(create=1)
system_app = context.getApplication()
SESSION = context.REQUEST.SESSION
currStack = SESSION.get('HEC_STACK',[{}])
if not len(currStack) :
currStack = [{}]
return currStack
--- NEW FILE: getSessionValue.py ---
## Script (Python) "getSessionValue"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=key, defaultVal=''
##title=
##
result = defaultVal
ns = context.getTopNamespace()
if ns:
result = ns.get(key,result)
return result
--- NEW FILE: getTopNamespace.py ---
## Script (Python) "getTopNamespace"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Return the Top Stack Dict
##
result = {}
currStack = context.getCurrentStack()
if currStack:
result = currStack[-1]
result.update({'hec_v_stackSize':len(currStack)})
return result
--- NEW FILE: guess_type.py ---
## Script (Python) "guess_type"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=value
##title=Get the Current Stack
##
if same_type(value,''):
return 'string'
elif same_type(value,0):
return 'int'
elif same_type(value,0.0):
return 'float'
elif same_type(value,[]):
return 'list'
elif same_type(value,{}):
return 'structure'
else:
return 'unknown'
--- NEW FILE: manage_edit_stack_levels.py ---
## Script (Python) "getCurrentStack"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=sessionLevels=None, submit=None, indexes=None
##title=Get the Current Stack
##
if submit == 'EDIT':
indexes = []
if submit in ['EDIT','DELETE']:
newStack = []
for i in range(len(sessionLevels)):
level = sessionLevels[i]
if level.index not in indexes:
newLevel = {}
newStack.append(newLevel)
for k in level.keys():
newLevel[k] = level[k]
context.setCurrentStack(newStack)
else:
raise RuntimeError, "I don't know that one!: " + `submit` + ":" + `indexes`
context.REQUEST.RESPONSE.redirect( context.REQUEST.URL1 + '/manage_session_stack')
--- NEW FILE: manage_session_stack.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="header">
<h1 id="DesktopTitle"
tal:content="here/Title">Document Title</h1>
<div id="DesktopDescription">
This is a screen for managing your current system stack.
</div>
</div>
<div metal:fill-slot="main">
<div tal:define="theStack here/getCurrentStack">
<br><br>
<form action="manage_edit_stack_levels" method="post">
<table>
<tr tal:repeat="stackLevel theStack">
<td><h3><input type="checkbox" name="indexes:int:list" tal:attributes="value repeat/stackLevel/index"><span tal:content="string:Level ${repeat/stackLevel/index}" /></h3>
<input type="hidden" name="sessionLevels.index:int:records" tal:attributes="value repeat/stackLevel/index"/></td>
<td><table tal:define="itemKeys stackLevel/keys" border="1"><tr><td>
<table>
<tr tal:repeat="itemKey itemKeys">
<tal:block tal:omit-tag="" tal:define="itemValue python:stackLevel[itemKey];
itemType python:here.guess_type(itemValue)">
<td tal:content="string:${itemKey} (${itemType})"/><td><input size="20" tal:attributes="name string:sessionLevels.${itemKey}:${itemType}:records;
value itemValue"></td>
</tal:block>
</tr>
</table>
</td></tr></table>
</td>
</tr>
</table>
<input type="submit" value="EDIT" name="submit">
<input type="submit" value="DELETE" name="submit">
</form>
</div>
</div>
</body>
</html>
--- NEW FILE: popStateInfo.py ---
## Script (Python) "popStateInfo""
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=stateDict=None
##title=
##
currStack = context.getCurrentStack()
try:
topInfo = currStack.pop()
except:
currStack = context.getCurrentStack()
context.setCurrentStack( currStack )
return currStack
--- NEW FILE: pushStateInfo.py ---
## Script (Python) "pushStateInfo"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=stateDict=None
##title=
##
if stateDict is None:
stateDict = context.REQUEST.form
currStack = context.getCurrentStack()
currStack.append(stateDict)
context.setCurrentStack( currStack )
return "OK"
--- NEW FILE: setCurrentStack.py ---
## Script (Python) "setCurrentStack"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=currStack
##title=
##
SESSION = context.REQUEST.SESSION
SESSION['BSM_STACK'] = currStack
return "OK!"
--- NEW FILE: setSessionValues.py ---
## Script (Python) "setSessionValues"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=key=None, value=None, kwDict=None, **kw
##title=
##
currStack = context.getCurrentStack()
dataDict = kw
if key is not None:
dataDict[key] = value
if kwDict is not None:
dataDict.update(kwDict)
topDict = currStack[-1]
for key, val in dataDict.items():
topDict[key] = val
context.setCurrentStack(currStack)
return topDict
--- NEW FILE: setupRequest.py ---
## Script (Python) "setupRequest"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
import string
REQUEST=context.REQUEST
if not REQUEST.get('HEC_Setup',None):
rawInput = context.mmu_getRawInput(REQUEST)
xmlDict = {}
if len(rawInput):
try:
xmlDict = context.mmu_handleXML(rawInput)
dataDict = xmlDict['RequestData']['Variables']
except:
dataDict = REQUEST.form
else:
dataDict = REQUEST.form
#
# translation
#
REQUEST.set('dataDict', dataDict)
REQUEST.set('xmlDict', xmlDict)
REQUEST.set('listsUpdated',dataDict.get('listsUpdated','2000/1/1'))
try:
size = string.atoi(dataDict.get('size','20'))
except:
size = 20
REQUEST.set('size',size)
dataDict['size'] = size
try:
start = string.atoi(dataDict.get('start','1'))
except:
start = 1
REQUEST.set('start',start)
dataDict['start'] = start
REQUEST.set('HEC_Setup',1)
--- NEW FILE: zapp_cmf_object_edit.py ---
## Script (Python) "question_edit"
dict = {}
dict.update(context.REQUEST.form)
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, [])
if currVal:
currVal = currVal[:-1]
context.safeMiscData.setXMLAttrs(dict = dict)
context.REQUEST.RESPONSE.redirect('zapp_cmf_object_edit_form')
--- NEW FILE: zapp_cmf_object_edit_form.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="main">
ZApp CMF Thingy..
<!-- A ZApp CMF property set is a list of objects/dictionaries (stored as 'zapp_properties') in the TypeProperty
each object has several required attributes:
'name': is the name of the property
'type': is it's type simple types like: 'float','int','long','string','date','boolean',
complex types like: 'int:list', (a list of values, the type specified before the ':' is the type of each value),
'record' (a structure or dictionary),
'records' (a list of structures of dictionaries),)
if record or 'records' is used... there is also:
'subObject': which is another propertySet for that record type.
-->
<div tal:define="myApp python:here.findApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
typePropertiesObjects python:miscDataSpecialist.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='ZCMFPropsFor' + myType);
myTPropsMiscData python:typePropertiesObjects and typePropertiesObjects[0].getXMLDict();
myPropSet myTPropsMiscData/zapp_properties | nothing;
myProperties python:here.safeMiscData.getXMLDict()">
<table tal:condition="myPropSet">
<form action="zapp_cmf_object_edit" method="post">
<tr tal:repeat="propDef myPropSet">
<td tal:define="propName propDef/name;
propType propDef/type;
subObject propDef/subObject | python:[];
subDefs subObject/zapp_properties | python:[];
propValue python:myProperties.get(propName,'')">
<table tal:condition="python:propType in ['float','int','long','string','date']">
<tr><td tal:content="string:${propName}(${propType})"/><td><input tal:attributes="name string:${propName}:${propType}; value propValue"></td></tr>
</table>
<table tal:condition="python:propType in ['text']">
<tr><td tal:content="string:${propName}(${propType})"/><td><textarea tal:content="propValue" tal:attributes="name string:${propName}" rows="5" cols="40"/></td></tr>
</table>
<table tal:condition="python:propType in ['boolean']">
<tr><td tal:content="string:${propName}(${propType})"/><td><input type="checkbox" value="1" tal:attributes="name string:${propName}:int; checked propValue"></td></tr>
</table>
<table tal:condition="python:('list' in propType.split(':')) and propValue">
<tr tal:repeat="item propValue" tal:define="propType python:propType.split(':')[0]">
<td tal:content="python:'Item ' + path('item/repeat/index') + 1" />
<td><input tal:attributes="name string:${propName}:${propType}:list; value item"/></td>
</tr>
</table>
<table border="1" tal:condition="python:subObject and (propType=='record')">
<tr><td colspan="2" tal:content="string:${propName} --- structure/object"/></tr>
<tr tal:repeat="propDef subDefs">
<tal:block tal:omit-tag=""
tal:define="subPropName propDef/name;
propType propDef/type;
propValue python:propValue and propValue.get(subPropName,'')">
<td tal:content="string:${subPropName}(${propType})"/>
<td><input tal:condition="python:propType not in ['boolean','text']" tal:attributes="name string:${propName}.${subPropName}:${propType}:record; value propValue">
<textarea tal:condition="python:propType in ['text']" tal:content="propValue" tal:attributes="name string:${propName}.${subPropName}:record;" rows="5" cols="40"/>
<input tal:condition="python:propType in ['boolean']" type="checkbox" value="1" tal:attributes="name string:${propName}.${subPropName}:int:record; checked propValue">
</td>
</tal:block>
</tr>
</table>
<table tal:condition="python:subObject and (propType=='records')">
<tr>
<td><input type="radio" name="propToChange" tal:attributes="value string:${propName}"></td>
<td tal:repeat="subDef subDefs"><span tal:content="string:${subDef/name}(${subDef/type})"/></td>
</tr>
<tr tal:repeat="currItem python:propValue or [{}]"><td> </td>
<td tal:repeat="propDef subDefs"><span tal:omit-tag="" tal:define="subPropName propDef/name;
subpropType propDef/type;
currVal python:currItem.get(subPropName,'')">
<input tal:condition="python:subpropType in ['float','int','long','string','date']" tal:attributes="name string:${propName}.${subPropName}:records; value currVal">
<input tal:condition="python:subpropType in ['boolean']" type="checkbox" value="1" tal:attributes="name string:${propName}.${subPropName}:int:records; checked currVal">
<textarea tal:condition="python:subpropType in ['text']" tal:content="currVal" tal:attributes="name string:${propName}.${subPropName}:records;" rows="5" cols="40"/>
</span>
</td>
</tr>
</table>
</td></tr>
<tr><td><input name="submit" type="submit" value="edit" ><input name="submit" type="submit" value="add row" ><input name="submit" type="submit" value="delete row" ></td></tr>
</form>
</table>
<div tal:condition="not:myPropSet"> Sorry.. there is no propSet for this type! </div>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_cmf_object_get_info.py ---
# Example code:
return context.safeMiscData.getXMLAttr('questionInfo')
--- NEW FILE: zapp_cmf_object_type_edit.py ---
## Script (Python) "question_edit"
myApp = context.findApplication()
myType = context.portal_type
miscData = myApp.MiscData
tpropObjects = miscData.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='ZCMFPropsFor' + myType)
myTPropsObj = tpropObjects and tpropObjects[0]
myTPropDict = (myTPropsObj and myTPropsObj.getXMLDict()) or {}
myTPropDefs = myTPropDict.get('zapp_properties',[])
inputDict = {}
inputDict.update(context.REQUEST.form) # get a 'real' dictionary object..
result = "original dict = '%s'" % `myTPropDefs`
if inputDict.has_key('submit'):
submitValue = inputDict.get('submit','')
selectedNames = inputDict.get('names',[])
selectedSubNames = inputDict.get('subnames',[])
if (len(selectedNames) and len(selectedSubNames)):
raise RuntimeError, "pick root level items, or subobject items, but not both!"
if submitValue == 'delete property':
if len(selectedNames):
newTPropDefs = []
for item in myTPropDefs:
if item.get('name','') not in selectedNames:
newTPropDefs.append( item )
myTPropDefs = newTPropDefs
elif len(selectedSubNames):
for subName in selectedSubNames:
objName, subName = subName.split(':',1)
for item in myTPropDefs:
if item.get('name','') == objName:
subObject = item.get('subObject',{})
subTPropDefs = subObject.get('zapp_properties',[])
newSubTPropDefs = []
for subitem in subTPropDefs:
if subitem.get('name','') != subName:
newSubTPropDefs.append( subitem )
subObject['zapp_properties'] = newSubTPropDefs
elif submitValue == 'top':
if len(selectedNames):
topList = []
bottomList = []
for item in myTPropDefs:
if item.get('name','') in selectedNames:
topList.append( item )
else:
bottomList.append( item )
myTPropDefs = topList + bottomList
elif len(selectedSubNames):
for subName in selectedSubNames:
objName, subName = subName.split(':',1)
for item in myTPropDefs:
if item.get('name','') == objName:
subObject = item.get('subObject',{})
subTPropDefs = subObject.get('zapp_properties',[])
topList = []
bottomList = []
for subitem in subTPropDefs:
if subitem.get('name','') == subName:
topList.append( subitem )
else:
bottomList.append(subitem)
subObject['zapp_properties'] = topList + bottomList
elif submitValue == 'bottom':
if len(selectedNames):
topList = []
bottomList = []
for item in myTPropDefs:
if item.get('name','') in selectedNames:
bottomList.append( item )
else:
topList.append( item )
myTPropDefs = topList + bottomList
elif len(selectedSubNames):
for subName in selectedSubNames:
objName, subName = subName.split(':',1)
for item in myTPropDefs:
if item.get('name','') == objName:
subObject = item.get('subObject',{})
subTPropDefs = subObject.get('zapp_properties',[])
topList = []
bottomList = []
for subitem in subTPropDefs:
if subitem.get('name','') == subName:
bottomList.append( subitem )
else:
topList.append(subitem)
subObject['zapp_properties'] = topList + bottomList
elif submitValue == 'add new item':
newItem = inputDict.get('newItem')
if newItem.name:
newProp = {'name':newItem.name, 'type':newItem.propType}
if len(selectedNames) == 0:
if newItem.propType in ['record','records']:
newProp[ 'subObject' ] = {}
myTPropDefs.append( newProp )
elif len(selectedNames) == 1:
if newItem.propType in ['record','records']:
raise RuntimeError,"Only simple types allowed in records!"
for item in myTPropDefs:
if item.get('name','') in selectedNames:
subObject = item.get('subObject',{})
subTPropDefs = subObject.get('zapp_properties',[])
subTPropDefs.append( newProp )
subObject['zapp_properties'] = subTPropDefs
break
else:
raise RuntimeError, "You can only add to one record type at a time!"
if not myTPropsObj:
tpropObjects = miscData.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='ZCMFPropsFor' + myType, createIfNone=1)
myTPropsObj = tpropObjects and tpropObjects[0]
if not myTPropsObj:
raise RuntimeError, "Can't create new misc data object!"
myTPropsObj.setXMLAttrs({'zapp_properties': myTPropDefs})
context.REQUEST.RESPONSE.redirect('zapp_cmf_object_type_edit_form')
--- NEW FILE: zapp_cmf_object_type_edit_form.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="main">
<script type="text/javascript">
<!--
isSelected = false;
function toggleSelect() {
if (isSelected == false) {
for (i = 0; i < document.objectItems.length; i++)
document.objectItems.elements[i].checked = true ;
isSelected = true;
document.objectItems.selectButton.value = "Deselect All";
return isSelected;
}
else {
for (i = 0; i < document.objectItems.length; i++)
document.objectItems.elements[i].checked = false ;
isSelected = false;
document.objectItems.selectButton.value = "Select All";
return isSelected;
}
}
//-->
</script>
Type for ZApp CMF Thingy..
<!-- A ZApp CMF property set is a list of objects/dictionaries (stored as 'zapp_properties') in the TypeProperty
each object has several required attributes:
'name': is the name of the property
'type': is it's type simple types like: 'float','int','long','string','date','boolean',
complex types like: 'int:list', (a list of values, the type specified before the ':' is the type of each value),
'record' (a structure or dictionary),
'records' (a list of structures of dictionaries),)
if record or 'records' is used... there is also:
'subObject': which is another propertySet for that record type.
-->
<div tal:define="myApp python:here.findApplication();
myType here/portal_type;
miscDataSpecialist myApp/MiscData;
typePropertiesObjects python:miscDataSpecialist.ZApp_getItems(Manager='CMFThings', objectID='metaObject', dataType='ZCMFPropsFor' + myType);
myTPropsMiscData python:typePropertiesObjects and typePropertiesObjects[0].getXMLDict();
myPropSet myTPropsMiscData/zapp_properties | nothing">
<form action="zapp_cmf_object_type_edit" method="post">
<table tal:condition="myPropSet">
<tr tal:repeat="propDef myPropSet">
<td tal:define="propName propDef/name;
propType propDef/type;
subObject propDef/subObject | python:[];
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>
<table tal:condition="python:('list' in propType.split(':')) and propValue">
<tr><td><input type="checkbox" name="names:list" tal:attributes="value propName"/></td> <td tal:content="string:${propName}(${propType})"/></tr>
</table>
<table tal:condition="python:propType in ['record','records']">
<tr><td><input type="checkbox" name="names:list" tal:attributes="value propName"/></td> <td tal:content="string:${propName}(${propType})"/></tr>
<tr tal:repeat="subDef subDefs"><tal:block tal:omit-tag="" tal:define="subName subDef/name; subType subDef/type">
<td> </td>
<td> <input type="checkbox" name="subnames:list" tal:attributes="value string:${propName}:${subName}"><span tal:content="string:${subName}(${subType})"/></td></tal:block>
</tr>
</table>
</td></tr>
</table>
<hr>
<div>
<table>
<tr>
<td>Name:</td>
<td><input name="newItem.name:record"></td>
<td>
<select name="newItem.propType:record">
<span tal:repeat="item python:['string','text','float','int','long','date','boolean','array','record','records']">
<option tal:attributes="value item" tal:content="item"/>
</span></select> </td>
</tr>
</table>
</div>
<input type="submit" name="submit" value="delete property">
<input type="submit" name="submit" value="top">
<input type="submit" name="submit" value="bottom">
<input type="submit" name="submit" value="add new item">
</form>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_cmf_object_view.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="main">
<div tal:define="myApp python:here.findApplication();
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()">
ZApp CMF Thing.
<div tal:content="myTypePropertiesMiscData"> </div>
<div tal:content="myProperties"> </div>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_file_edit.py ---
## Script (Python) "hec_image_edit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# Example code:
file = context.REQUEST.form.get('file','')
portal = context.portal_url.getPortalObject()
if not file:
return "I need a file!"
path = context.getPhysicalPath()
print "I got a ", `file`
fileID = path[-1]
currFolder = portal.fSystem
for folder in path[1:-1]:
if folder in currFolder.objectIds('Folder'):
fsFolder = getattr(currFolder, folder, None)
else:
currFolder.manage_addFolder(folder)
fsFolder = getattr( currFolder, folder, None)
if not fsFolder:
raise RuntimeError, "Can't create folder!"
currFolder = fsFolder
fileObj = getattr(currFolder, fileID, None)
#print "adding ", `fileObj`," with id ", fileObj.id, " image to ", `currFolder`, currFolder.id
if fileObj is None:
currFolder.manage_addFile(id=fileID, file=file)
fileObj = getattr(currFolder, fileID, None)
print "I'm creating a file object.. "
try:
print "I'm trying to upload a file"
fileObj.manage_upload(file)
except:
print "I failed.. by getting a ", `fileObj`
return printed
context.REQUEST.RESPONSE.redirect('view')
--- NEW FILE: zapp_file_edit_form.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="here/main_template/macros/master">
<body>
<div metal:fill-slot="main" i18n:domain="cmf_default">
<div class="Desktop">
<span tal:replace="request/message"
tal:condition="request/message|nothing"><hr /></span>
<h2 i18n:translate="">Edit <span
tal:replace="here/getId" i18n:name="objectid">My ID</span></h2>
<form action="hec_file_edit" method="post" enctype="multipart/form-data"
tal:attributes="action string:${here/absolute_url}/hec_file_edit"
>
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td> <span tal:replace="here/Title">My Title</span></td>
</tr>
<tr>
<th i18n:translate="">Description</th>
<td> <span tal:replace="here/Description">My Description</span></td>
</tr>
<tr>
<th i18n:translate="">Content type</th>
<td> <span tal:replace="here/Format">html/text</span></td>
</tr>
<tr>
<th i18n:translate="">Upload file</th>
<td> <input type="file" name="file" size="35" /> </td>
</tr>
<tr>
<td> <br /> </td>
<td>
<input type="submit" name="change" value=" Change "
i18n:attributes="value" />
<input type="submit" name="change_and_view" value=" Change and View "
i18n:attributes="value" />
</td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_file_view.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="header">
<h1 id="DesktopTitle"
tal:content="here/Title">Document Title</h1>
<div id="DesktopDescription" tal:content="here/Description">
Document Description goes here.
</div>
<div metal:use-macro="here/content_byline/macros/byline">By Me</div>
</div>
<div metal:fill-slot="main" i18n:domain="cmf_default">
<h2 i18n:translate=""> File Properties </h2>
<table tal:define="theFile here/hec_image_get_fileObj">
<tr>
<th align="right" i18n:translate="">Filename</th>
<td tal:content="theFile/getId">My ID</td>
</tr>
<tr>
<th align="right" i18n:translate="">Size</th>
<td tal:content="theFile/size">1024K</td>
</tr>
<tr>
<th align="right" i18n:translate="">Content-type</th>
<td tal:content="theFile/content_type">application/gzip</td>
<tr>
<tr>
<td> <br /> </td>
<td>
</td>
</tr>
</table>
<h2 i18n:translate="">Download File</h2>
<p> <a href="." title="Download File"
tal:define="file here/absolute_url"
tal:attributes="href file; title here/Title"
tal:content="string:Download ${here/Title}">Download File</a>
</p>
<div class="Discussion">
<span tal:replace="structure here/viewThreadsAtBottom"
tal:condition="here/viewThreadsAtBottom|nothing"></span>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_get_fileObj.py ---
portal = context.portal_url.getPortalObject()
path = context.getPhysicalPath()
fileID = path[-1]
currFolder = portal.fSystem
for folder in path[1:-1]:
if folder in currFolder.objectIds('Folder'):
fsFolder = getattr(currFolder, folder, None)
if not fsFolder:
raise RuntimeError, "Can't find folder!" + folder
currFolder = fsFolder
return getattr(currFolder, fileID, None)
--- NEW FILE: zapp_image_edit.py ---
## Script (Python) "hec_image_edit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# Example code:
file = context.REQUEST.form.get('file','')
portal = context.portal_url.getPortalObject()
if not file:
return "I need a file!"
path = context.getPhysicalPath()
print "I got a ", `file`
fileID = path[-1]
currFolder = portal.fSystem
for folder in path[1:-1]:
if folder in currFolder.objectIds('Folder'):
fsFolder = getattr(currFolder, folder, None)
else:
currFolder.manage_addFolder(folder)
fsFolder = getattr( currFolder, folder, None)
if not fsFolder:
raise RuntimeError, "Can't create folder!"
currFolder = fsFolder
fileObj = getattr(currFolder, fileID, None)
#print "adding ", `fileObj`," with id ", fileObj.id, " image to ", `currFolder`, currFolder.id
if fileObj is None:
currFolder.manage_addImage(id=fileID, file=file)
fileObj = getattr(currFolder, fileID, None)
print "I'm creating a file object.. "
try:
print "I'm trying to upload a file"
fileObj.manage_upload(file)
except:
print "I failed.. by getting a ", `fileObj`
return printed
context.REQUEST.RESPONSE.redirect('view')
--- NEW FILE: zapp_image_edit_form.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="here/main_template/macros/master">
<body>
<div metal:fill-slot="main" i18n:domain="cmf_default">
<div class="Desktop">
<span tal:replace="request/message"
tal:condition="request/message|nothing"><hr /></span>
<div class="Image">
<h2 i18n:translate="">Edit <span
tal:replace="here/getId" i18n:name="objectid">My ID</span></h2>
<form action="hec_image_edit" method="post" enctype="multipart/form-data"
tal:attributes="action string:${here/absolute_url}/hec_image_edit"
>
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td> <span tal:replace="here/Title">My Title</span> </td>
</tr>
<tr>
<th i18n:translate="">Description</th>
<td> <span tal:replace="here/Description">My Description</span> </td>
</tr>
<tr>
<th i18n:translate="">Content type</th>
<td> <span tal:replace="here/Format">text/html</span> </td>
</tr>
<tr>
<th i18n:translate="">Upload image</th>
<td> <input type="file" name="file" size="25" /> </td>
</tr>
<tr>
<td> <br /> </td>
<td>
<input type="submit" name="change" value=" Change "
i18n:attributes="value" />
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>
--- NEW FILE: zapp_image_view.pt ---
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
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>
<div metal:fill-slot="header">
<h1 id="DesktopTitle"
tal:content="here/Title">Document Title</h1>
<div id="DesktopDescription" tal:content="here/Description">
Document Description goes here.
</div>
<div metal:use-macro="here/content_byline/macros/byline">By Me</div>
</div>
<div metal:fill-slot="main">
<img tal:attributes="src python:here.hec_image_get_fileObj().absolute_url()"/>
<div class="Discussion">
<span tal:replace="structure here/viewThreadsAtBottom"
tal:condition="here/viewThreadsAtBottom|nothing"></span>
</div>
</div>
</body>
</html>
|
|
From: <ssp...@us...> - 2003-06-25 11:45:57
|
Update of /cvsroot/zapp/ZApp/leverMethods/MySQL
In directory sc8-pr-cvs1:/tmp/cvs-serv14999/leverMethods/MySQL
Modified Files:
createSchemaLever.plain
Log Message:
added some skins to ZApp CMF core..
Index: createSchemaLever.plain
===================================================================
RCS file: /cvsroot/zapp/ZApp/leverMethods/MySQL/createSchemaLever.plain,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** createSchemaLever.plain 4 May 2003 16:16:13 -0000 1.4
--- createSchemaLever.plain 25 Jun 2003 11:45:53 -0000 1.5
***************
*** 16,20 ****
primaryKey = specialist.getPrimaryKey()
! defaultSize = 30
typeLookups = {
--- 16,22 ----
primaryKey = specialist.getPrimaryKey()
! primaryKey = specialist.getPrimaryKey()
! defaultSize = specialist.ZApp_getDefaultStringSize()
! pKeySize = specialist.ZApp_getPrimaryKeySize()
typeLookups = {
***************
*** 48,52 ****
templateString = templateString + ("\n create table %s ( \n" % specialist.id)
! itemList = [" %s varchar(40) NOT NULL PRIMARY KEY" % primaryKey]
for item in pm:
--- 50,54 ----
templateString = templateString + ("\n create table %s ( \n" % specialist.id)
! itemList = [" %s varchar(%i) NOT NULL PRIMARY KEY" % (primaryKey, pKeySize)]
for item in pm:
|
|
From: <ssp...@us...> - 2003-06-25 11:45:57
|
Update of /cvsroot/zapp/ZApp/skins/zapp_xml
In directory sc8-pr-cvs1:/tmp/cvs-serv14999/skins/zapp_xml
Added Files:
getInstantXMLConfig.py wrapXML.py
Log Message:
added some skins to ZApp CMF core..
--- NEW FILE: getInstantXMLConfig.py ---
## Script (Python) "getInstantXMLConfig.py"
##parameters=
##title=Get info to connect to Instant XML Server..
##
request = context.REQUEST
xmlhost = request.HTTP_HOST.split(':')[0]
xmlport = getattr(context, 'IXML_PORT', 8518)
sender_id = getattr(context, 'sender_id', 'c1:flash')
return {'xmlhost':xmlhost, 'xmlport':xmlport, 'sender_id':sender_id}
--- NEW FILE: wrapXML.py ---
## Script (Python) "wrapXML.py"
##parameters=response=1, methodName=None, *args, **kw
##title=Wrap something in XMLRPC..
##
argDict = {}
import xmlrpclib
if kw:
argDict.update(kw)
else:
argDict.update(context.REQUEST.form)
method = traverse_subpath and traverse_subpath[0]
for arg in 'response','methodName':
if argDict.has_key(arg):
del argDict[arg]
result = argDict
if method:
realMethod = context.restrictedTraverse(method)
if realMethod:
result = apply(realMethod, args, argDict)
elif methodName:
realMethod = getattr(context, methodName, None)
if realMethod:
result = apply(realMethod, args, kw)
return xmlrpclib.dumps((result,), None, 1)
|
|
From: <ssp...@us...> - 2003-06-25 11:45:56
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv14999
Modified Files:
ZApp_Base.py ZApp_CMFBase.py ZApp_MiscData.py
ZApp_Specialist.py __init__.py
Log Message:
added some skins to ZApp CMF core..
Index: ZApp_Base.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Base.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ZApp_Base.py 20 Jun 2003 11:23:18 -0000 1.18
--- ZApp_Base.py 25 Jun 2003 11:45:53 -0000 1.19
***************
*** 15,18 ****
--- 15,20 ----
from Products.ZPatterns.SkinScript.Components import Trigger, Compute
from ZApp_LOG import ZApp_LOG
+ import ZApp_Application
+
from Products.ZPatterns.DataSkins import _v_dm_
from Products.ZPatterns.SheetProviders import SheetProvider
***************
*** 97,101 ****
lever_object_type = 'Lever Property Collection'
! def __init__(self, collection=None, prop_default='', type_default='string', size_default=30 ):
self.prop_default = prop_default
--- 99,103 ----
lever_object_type = 'Lever Property Collection'
! def __init__(self, collection=None, prop_default='', type_default='string', size_default=30, pkey_size=50 ):
self.prop_default = prop_default
***************
*** 231,242 ****
currObject = self
- app_meta = self.applicationMetaType
while 1:
! if not currObject:
! raise RuntimeError, "Hmm. that doesn't make any sense!.. there is no application!"
! if currObject.meta_type == app_meta:
break
currObject = currObject.aq_parent
--- 233,250 ----
currObject = self
while 1:
! if (not currObject) or (not hasattr(currObject, 'meta_type')):
! raise RuntimeError, "Hmm. thaf's odd.. I can't find any ZApp Application here!"
! if currObject.meta_type == ZApp_Application.ZApp_Application.meta_type:
break
+
+ if hasattr(currObject, 'objectIds') and currObject.objectIds( ZApp_Application.ZApp_Application.meta_type ):
+ apps = currObject.objectValues( ZApp_Application.ZApp_Application.meta_type )
+ result = apps and apps[0]
+ if result:
+ currObject = result
+ break
currObject = currObject.aq_parent
Index: ZApp_CMFBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_CMFBase.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ZApp_CMFBase.py 13 Jun 2003 13:59:53 -0000 1.7
--- ZApp_CMFBase.py 25 Jun 2003 11:45:53 -0000 1.8
***************
*** 25,28 ****
--- 25,29 ----
meta_type = 'ZApp CMF Content Type'
zapp_cmf_type = 1
+ _primaryKeyStringSize=255 # allow for a pretty rediculous size...
__implements__ = ( PortalContent.__implements__
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ZApp_MiscData.py 20 Jun 2003 11:23:18 -0000 1.11
--- ZApp_MiscData.py 25 Jun 2003 11:45:53 -0000 1.12
***************
*** 25,29 ****
[lprop(id='Manager'),
lprop(id='objectID'),
! lprop(id='dataType'),
lprop(id='xml', prop_type='text', dbType='text'),
]
--- 25,29 ----
[lprop(id='Manager'),
lprop(id='objectID'),
! lprop(id='dataType', dbSize=100),
lprop(id='xml', prop_type='text', dbType='text'),
]
***************
*** 105,109 ****
def setXMLAttr(self, attr, value):
""" set an XML attribute to a value."""
! selt._setXMLAttr( attr, value)
self.buildXML()
--- 105,109 ----
def setXMLAttr(self, attr, value):
""" set an XML attribute to a value."""
! self._setXMLAttr( attr, value)
self.buildXML()
Index: ZApp_Specialist.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Specialist.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** ZApp_Specialist.py 20 Jun 2003 04:15:08 -0000 1.26
--- ZApp_Specialist.py 25 Jun 2003 11:45:53 -0000 1.27
***************
*** 399,407 ****
return self.ZApp_getItemClassAttr('_primaryKeyGenerator')
! def ZApp_getItemClassAttr(self, attr):
"""
Return the class for objects managed by this ZApp_Specialist.
"""
! return self.defaultRack.getKlassAttr( attr )
--- 399,419 ----
return self.ZApp_getItemClassAttr('_primaryKeyGenerator')
! def ZApp_getDefaultStringSize(self):
! """
! return a default string size for dbSize...
! """
! return self.ZApp_getItemClassAttr('_defaultStringSize',30)
!
! def ZApp_getPrimaryKeySize(self):
! """
! return a default string size for dbSize...
! """
! return self.ZApp_getItemClassAttr('_primaryKeyStringSize',40)
!
! def ZApp_getItemClassAttr(self, attr, default=None):
"""
Return the class for objects managed by this ZApp_Specialist.
"""
! return self.defaultRack.getKlassAttr( attr, default )
Index: __init__.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/__init__.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** __init__.py 18 Jun 2003 19:11:19 -0000 1.13
--- __init__.py 25 Jun 2003 11:45:53 -0000 1.14
***************
*** 61,65 ****
context.registerHelp()
context.registerHelpTitle('ZApp Help')
!
if __name__=='__main__':
--- 61,70 ----
context.registerHelp()
context.registerHelpTitle('ZApp Help')
!
!
! from Products.CMFCore.DirectoryView import registerDirectory
! registerDirectory('skins', globals())
!
! zapp_globals = globals()
if __name__=='__main__':
|
|
From: <ssp...@us...> - 2003-06-25 11:45:56
|
Update of /cvsroot/zapp/ZApp/leverMethods/PG
In directory sc8-pr-cvs1:/tmp/cvs-serv14999/leverMethods/PG
Modified Files:
createSchemaLever.plain
Log Message:
added some skins to ZApp CMF core..
Index: createSchemaLever.plain
===================================================================
RCS file: /cvsroot/zapp/ZApp/leverMethods/PG/createSchemaLever.plain,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** createSchemaLever.plain 9 May 2003 12:53:07 -0000 1.7
--- createSchemaLever.plain 25 Jun 2003 11:45:53 -0000 1.8
***************
*** 16,20 ****
primaryKey = specialist.getPrimaryKey()
! defaultSize = 30
typeLookups = {
--- 16,21 ----
primaryKey = specialist.getPrimaryKey()
! defaultSize = specialist.ZApp_getDefaultStringSize()
! pKeySize = specialist.ZApp_getPrimaryKeySize()
typeLookups = {
***************
*** 47,51 ****
templateString = templateString + ("\n create table %s ( \n" % specialist.id)
! itemList = [" %s varchar(40) DEFAULT 'AUTO' || CAST(nextval('%s') as TEXT) PRIMARY KEY" % (primaryKey, sequenceName)]
for item in pm:
--- 48,52 ----
templateString = templateString + ("\n create table %s ( \n" % specialist.id)
! itemList = [" %s varchar(%i) DEFAULT 'AUTO' || CAST(nextval('%s') as TEXT) PRIMARY KEY" % (primaryKey, pKeySize, sequenceName)]
for item in pm:
|
|
From: <ssp...@us...> - 2003-06-25 11:45:56
|
Update of /cvsroot/zapp/ZApp/Extensions
In directory sc8-pr-cvs1:/tmp/cvs-serv14999/Extensions
Added Files:
Install.py
Log Message:
added some skins to ZApp CMF core..
--- NEW FILE: Install.py ---
"""
Installer for CMF Survey..
"""
__version__='$Revision: 1.1 $'[11:-2]
from Products.CMFCore.TypesTool import ContentFactoryMetadata
from Products.CMFCore.DirectoryView import addDirectoryViews
from Products.CMFCore.utils import getToolByName
from Products.ZApp import ZApp_CMFBase, zapp_globals
from ZODB.PersistentMapping import PersistentMapping
from cStringIO import StringIO
import string
def install(self):
" Register ZApp_CMF_Base with portal_types and friends "
out = StringIO()
typestool = getToolByName(self, 'portal_types')
skinstool = getToolByName(self, 'portal_skins')
workflowtool = getToolByName(self, 'portal_workflow')
# Borrowed from CMFDefault.Portal.PortalGenerator.setupTypes()
# We loop through anything defined in the factory type information
# and configure it in the types tool if it doesn't already exist
for t in ZApp_CMFBase.factory_type_information:
if t['id'] not in typestool.objectIds():
cfm = apply(ContentFactoryMetadata, (), t)
typestool._setObject(t['id'], cfm)
out.write('Registered %s with the types tool\n' % t['id'])
else:
out.write('Object "%s" already existed in the types tool\n' % (
t['id']))
# Setup the skins
if 'zapp_generic' not in skinstool.objectIds():
# We need to add Filesystem Directory Views for any directories
# in our skins/ directory. These directories should already be
# configured.
addDirectoryViews(skinstool, 'skins', zapp_globals)
out.write("Added 'hec' directory view to portal_skins\n")
# ---------------------
# Now we need to go through the skin configurations and insert
# 'zbsm' into the configurations. Preferably, this should be
# right before where 'content' is placed. Otherwise, we append
# it to the end.
skins = skinstool.getSkinSelections()
for skin in skins:
path = skinstool.getSkinPath(skin)
path = map(string.strip, string.split(path,','))
for dir in ('zapp_generic','zapp_xml',):
if not dir in path:
try:
idx = path.index( 'custom' )
except ValueError:
idx = 999
path.insert( idx+1, dir )
out.write("Added '%s' to %s skin\n" % (dir,skin))
path = string.join(path, ', ')
# addSkinSelection will replace existing skins as well.
out.write("for skin %s setting path.. %s\n" % (skin, path))
skinstool.addSkinSelection(skin, path)
out.seek(0)
result = out.read()
return "OK!\n\n" + result
|
|
From: <ssp...@us...> - 2003-06-25 05:41:05
|
Update of /cvsroot/zapp/ZApp/skins/zapp_generic In directory sc8-pr-cvs1:/tmp/cvs-serv6710/skins/zapp_generic Log Message: Directory /cvsroot/zapp/ZApp/skins/zapp_generic added to the repository |
|
From: <ssp...@us...> - 2003-06-25 05:41:05
|
Update of /cvsroot/zapp/ZApp/skins/zapp_xml In directory sc8-pr-cvs1:/tmp/cvs-serv6710/skins/zapp_xml Log Message: Directory /cvsroot/zapp/ZApp/skins/zapp_xml added to the repository |
|
From: <ssp...@us...> - 2003-06-25 05:40:37
|
Update of /cvsroot/zapp/ZApp/skins In directory sc8-pr-cvs1:/tmp/cvs-serv6682/skins Log Message: Directory /cvsroot/zapp/ZApp/skins added to the repository |
|
From: <ssp...@us...> - 2003-06-20 11:23:22
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv1055
Modified Files:
ZApp_Base.py ZApp_MiscData.py
Log Message:
fixed cache problem by moving _v_MyMDMCache to transaction flush list..
Index: ZApp_Base.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Base.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** ZApp_Base.py 18 Jun 2003 19:11:19 -0000 1.17
--- ZApp_Base.py 20 Jun 2003 11:23:18 -0000 1.18
***************
*** 307,315 ****
"""
! listishePropNames = ['_indexed_attrs', '_custom_skin_scripts']
!
! for lName in listishePropNames:
flatDict = listisheRecurse(klass, lName)
setattr(klass,lName,flatDict['listishe_masterList'])
def extendProperties_list( klass, props, value_default='', type_default='string', size_default=30 ):
--- 307,317 ----
"""
! for lName in ['_indexed_attrs', '_custom_skin_scripts']:
flatDict = listisheRecurse(klass, lName)
setattr(klass,lName,flatDict['listishe_masterList'])
+
+ for lName in ['__per_transaction_cache_attrs__']:
+ flatDict = listisheRecurse(klass, lName)
+ setattr(klass,lName,tuple(flatDict['listishe_masterList']))
def extendProperties_list( klass, props, value_default='', type_default='string', size_default=30 ):
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ZApp_MiscData.py 20 Jun 2003 04:15:08 -0000 1.10
--- ZApp_MiscData.py 20 Jun 2003 11:23:18 -0000 1.11
***************
*** 36,40 ****
meta_type = "ZApp Misc Data"
! __per_transaction_cache_attrs__ = ZApp_Base.ZApp_Base.__per_transaction_cache_attrs__ + ('_v_xmlDict',)
def _v_xmlDict(self):
--- 36,40 ----
meta_type = "ZApp Misc Data"
! __per_transaction_cache_attrs__ = ('_v_xmlDict',)
def _v_xmlDict(self):
***************
*** 149,153 ****
miscDataManagerKey = None
! _v_MyMDMCache = {}
_custom_skin_scripts = ("WITH self.getMiscData() COMPUTE miscData=RESULT",
--- 149,154 ----
miscDataManagerKey = None
!
! __per_transaction_cache_attrs__ = ('_v_MyMDMCache',)
_custom_skin_scripts = ("WITH self.getMiscData() COMPUTE miscData=RESULT",
***************
*** 156,159 ****
--- 157,170 ----
)
+ def _v_MyMDMCache(self):
+ """get dictionary to lookup MiscData objects I'm using.... """
+
+ self._v_Keeper # make sure we flush at transaction boundaries..
+
+ v = self._v_MyMDMCache = {}
+ return v
+
+ _v_MyMDMCache = ComputedAttribute( _v_MyMDMCache )
+
def applicationURL(self):
"""
***************
*** 231,247 ****
result += thePropManagers
return result
!
! def getMiscDataObj(self, Manager=None, dataType=''):
! """
! get all of my misc data objects that have my manager, objectID, and (optionally) specified data type
! """
!
! if Manager is None:
! Manager = self.miscDataManager
!
! mds = self.getMiscDataSpecialist()
! mdobs = mds and mds.ZApp_getItems( objectID=self.id, Manager=Manager, dataType=dataType)
! return mdobs and mdobs[0]
!
def applyTypeConverter(self, typeCode, value, args=None):
"""
--- 242,246 ----
result += thePropManagers
return result
!
def applyTypeConverter(self, typeCode, value, args=None):
"""
***************
*** 287,291 ****
xmlDict = {}
! mdobj = self.getMiscDataObj(dataType=dataType)
if mdobj:
xmlDict = mdobj.getXMLDict()
--- 286,290 ----
xmlDict = {}
! mdobj = self.getMiscData(dataType=dataType)
if mdobj:
xmlDict = mdobj.getXMLDict()
***************
*** 334,338 ****
return {}
! mdobj = self.getMiscDataObj(dataType=dataType)
if not mdobj:
return {}
--- 333,337 ----
return {}
! mdobj = self.getMiscData(dataType=dataType)
if not mdobj:
return {}
***************
*** 389,393 ****
if propertyManager:
! mdata = client.getMiscDataObj( dataType = name )
if not mdata:
mdata = client.setupMiscData( dataType = name )
--- 388,392 ----
if propertyManager:
! mdata = client.getMiscData( dataType = name )
if not mdata:
mdata = client.setupMiscData( dataType = name )
***************
*** 437,441 ****
propSheet = getattr(client, 'PropSheetFor_' + self.propsheetname)
default = getattr(propSheet, name, '')
! mdata = client.getMiscDataObj( dataType = self.propsheetname)
if not mdata:
--- 436,440 ----
propSheet = getattr(client, 'PropSheetFor_' + self.propsheetname)
default = getattr(propSheet, name, '')
! mdata = client.getMiscData( dataType = self.propsheetname)
if not mdata:
***************
*** 454,458 ****
if propertyManager:
! mdata = client.getMiscDataObj( dataType = name )
if not mdata:
return 0
--- 453,457 ----
if propertyManager:
! mdata = client.getMiscData( dataType = name )
if not mdata:
return 0
***************
*** 545,549 ****
self._client.buildXML()
return result
-
def initialize(context):
--- 544,547 ----
|
|
From: <ssp...@us...> - 2003-06-20 04:15:12
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv18192
Modified Files:
ZApp_MiscData.py ZApp_Specialist.py
Log Message:
Yee ha! It sorta works. ;->
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ZApp_MiscData.py 18 Jun 2003 19:11:19 -0000 1.9
--- ZApp_MiscData.py 20 Jun 2003 04:15:08 -0000 1.10
***************
*** 7,10 ****
--- 7,11 ----
dumps, loads = xmlrpclib.dumps, xmlrpclib.loads
+ StringType = type('')
from Products.ZPatterns.DataSkins import _v_dm_
***************
*** 29,32 ****
--- 30,35 ----
)
+ missing = []
+
class ZApp_MiscData(ZApp_Base.ZApp_Base):
***************
*** 67,79 ****
return self.xml
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 = value.value
! if len(value)>4 and value[4] != '-':
! value = '-'.join([value[:4],value[4:6],value[6:]])
! value = DateTime(value)
return value
def XMLAttrs(self):
--- 70,92 ----
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
+
+ def getXMLDict(self):
+ """ return the XML dictionary.. """
+ result = {}
+ result.update( self._v_xmlDict )
+ return result
def XMLAttrs(self):
***************
*** 118,123 ****
storeDict = {}
! missing = []
!
for key in attr_list:
val = getattr(obj, key, missing)
--- 131,135 ----
storeDict = {}
!
for key in attr_list:
val = getattr(obj, key, missing)
***************
*** 126,136 ****
self.setXMLAttrs( storeDict )
! class ZApp_MiscDataUser: # mixin for classes that need a MiscData 'bag'.
miscDataManagerKey = None
_v_MyMDMCache = {}
! _custom_skin_scripts = ("WITH self.getMiscDataSpecialist().ZApp_getItems( objectID=self.id, Manager=self.miscDataManager) COMPUTE miscData=(RESULT and RESULT[0])",
"WITH SELF COMPUTE miscDataManager = self.getMiscDataManager()",
"WITH SELF COMPUTE safeMiscData=self.miscData or self.setupMiscData()",
--- 138,155 ----
self.setXMLAttrs( storeDict )
+
+ ZApp_Base.extendProperties( ZApp_MiscData, props )
! class ZApp_MiscDataUser:
!
! """
! MiscdDataUsers are objects that need 'peripheral' storage
! of almost anything, 'on the fly'.
! """
miscDataManagerKey = None
_v_MyMDMCache = {}
! _custom_skin_scripts = ("WITH self.getMiscData() COMPUTE miscData=RESULT",
"WITH SELF COMPUTE miscDataManager = self.getMiscDataManager()",
"WITH SELF COMPUTE safeMiscData=self.miscData or self.setupMiscData()",
***************
*** 155,188 ****
return self.findApplication().getSpecialist('MiscData')
! def setupMiscData(self, Manager=None, dataType=''):
!
! missing = []
!
! if Manager is None:
! Manager = self.getMiscDataManager()
localmdmKey = Manager + ":" + dataType
mdm = self._v_MyMDMCache.get(localmdmKey, missing)
if mdm is missing:
! md = self.getMiscDataSpecialist() # get MiscData Manager..
!
! currentBag = None
! for aBag in md.ZApp_getItems( objectID = self.id, Manager = Manager):
if aBag.dataType == dataType:
! currentBag = aBag
break
! if not currentBag:
! #
! # there is no current manager..
! #
! currentBag = md.ZApp_createNewItem( objectID = self.id, Manager = Manager, dataType=dataType )
! self._v_MyMDMCache[localmdmKey] = currentBag
! else:
! currentBag = mdm
! return currentBag
def getDataPropertyManagers(self, withID=''):
--- 174,215 ----
return self.findApplication().getSpecialist('MiscData')
! def getMiscData(self, Manager=None, dataType=''):
! """
! Get MiscData object associated with this object/Manager/dataType combination..
! """
+ Manager = Manager or self.miscDataManager
localmdmKey = Manager + ":" + dataType
mdm = self._v_MyMDMCache.get(localmdmKey, missing)
if mdm is missing:
! mds = self.getMiscDataSpecialist()
! for aBag in mds.ZApp_getItems( objectID = self.id, Manager = Manager):
if aBag.dataType == dataType:
! mdm = aBag
break
! return mdm
! def setupMiscData(self, Manager=None, dataType='', checked=0):
! """
! If you *know* that there is no MiscData for this object..
! then calling with 'checked=1' will avoid a search.
! """
!
! mdm = None
! Manager = Manager or self.miscDataManager
!
! if not checked:
! mdm = self.getMiscData( Manager=Manager, dataType=dataType )
!
! if not mdm:
! 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=''):
***************
*** 216,220 ****
--- 243,362 ----
mdobs = mds and mds.ZApp_getItems( objectID=self.id, Manager=Manager, dataType=dataType)
return mdobs and mdobs[0]
+
+ def applyTypeConverter(self, typeCode, value, args=None):
+ """
+ apply a type converter/formatter to a value..
+ """
+ result = value
+ if typeCode:
+ converter = self.decodeTypeConverters.get( typeCode, missing)
+ if converter:
+ value = [value]
+ if type(converter) == StringType:
+ converter = getattr(self, converter, missing)
+
+ if args:
+ value = value + args
+
+ result = apply(converter, tuple(value))
+
+ if type(result) != StringType:
+ result = `result`
+
+ return result
+
+ encodeTypeConverters = {
+ }
+
+ def setMiscDataFor(self, dataDict, miscNameAttr='miscAttributeNames', dataType=''):
+ """
+ check for the existence of an attribute of this object with the name given by miscNameAttr
+ (e.g., check for the 'miscAttributeNames' attribute of self by default). If this attribute exists,
+ use it to access a MiscData object that corresponds to this set of attributes.
+
+ each attribute is either a simple name (e.,g., 'fatherName') or it could be
+ a name with a 'typecode' that specifies a type converter/formatter to display
+ the attribute with some special formatting (e.,g., 'attrName:typecode/arg1/arg2/arg3')
+ where arg1, arg2, arg3 etc are arguments for the conversion.
+ """
+
+ attrList = getattr(self, miscNameAttr, missing)
+
+ if attrList is missing:
+ return "No Attributes for '%s'." % miscNameAttr
+
+ xmlDict = {}
+ mdobj = self.getMiscDataObj(dataType=dataType)
+ if mdobj:
+ xmlDict = mdobj.getXMLDict()
+
+ for attr_and_type in attrList:
+ attr_type_list = attr_and_type.split(':')
+ attr = attr_type_list[0]
+ if dataDict.has_key(attr):
+ typecode = ''
+ if len(attr_type_list) > 2:
+ typecodeList = attr_type_list[2].split('/')
+ typecode = typecodeList[0]
+ if len(typecodeList) > 1:
+ args = map(lambda x,ca=checkArg: ca(x), typecodeList[1:])
+
+ value = dataDict.get(attr,missing)
+ if value is not missing:
+ if typecode:
+ value = self.applyTypeConverter(typecode, value, args)
+ xmlDict[attr] = value
+
+ if not mdobj:
+ mdobj = self.setupMiscData(dataType = dataType)
+
+ mdobj.setXMLAttrs( xmlDict )
+ return xmlDict
+
+ decodeTypeConverters = {
+ 'date':'sanitizeDateString',
+ }
+
+ def getMiscDataFor(self, miscNameAttr='miscAttributeNames', dataType=''):
+ """
+ check for the existence of an attribute of this object with the name given by miscNameAttr
+ (e.g., check for the 'miscAttributeNames' attribute of self by default). If this attribute exists,
+ use it to access a MiscData object that corresponds to this set of attributes.
+
+ each attribute is either a simple name (e.,g., 'fatherName') or it could be
+ a name with a 'typecode' that specifies a type converter/formatter to display
+ the attribute with some special formatting (e.,g., 'attrName:typecode/arg1/arg2/arg3')
+ where arg1, arg2, arg3 etc are arguments for the conversion.
+ """
+
+ attrList = getattr(self, miscNameAttr, missing)
+ if attrList is missing:
+ return {}
+
+ mdobj = self.getMiscDataObj(dataType=dataType)
+ if not mdobj:
+ return {}
+
+ result = {}
+ for attr_and_type in attrList:
+ attr_type_list = attr_and_type.split(':')
+ attr = attr_type_list[0]
+ typecode = ''
+ args = None
+ if len(attr_type_list) != 1:
+ typecodeList = attr_type_list[1].split('/')
+ typecode = typecodeList[0]
+ if len(typecodeList) != 1:
+ args = map(lambda x,ca=checkArg: ca(x), typecodeList[1:])
+
+ value = mdobj.getXMLAttr(attr)
+
+ if typecode:
+ value = self.applyTypeConverter(typecode, value, args)
+
+ result[attr] = value
+ return result
+
def getObjectInfo(self):
"""
***************
*** 229,240 ****
result[p['id']] = val
!
! result.update( self.getMiscDataFor( 'miscAttributes' ))
return result
- ZApp_Base.extendProperties( ZApp_MiscData, props )
-
- missing = []
class ZApp_MiscDataPropertySheetProvider( SheetProvider ):
--- 371,378 ----
result[p['id']] = val
! result.update( self.getMiscDataFor( 'miscAttributeNames' ))
return result
class ZApp_MiscDataPropertySheetProvider( SheetProvider ):
Index: ZApp_Specialist.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Specialist.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** ZApp_Specialist.py 12 Jun 2003 14:00:55 -0000 1.25
--- ZApp_Specialist.py 20 Jun 2003 04:15:08 -0000 1.26
***************
*** 42,45 ****
--- 42,46 ----
elif commit_mode:
get_transaction().commit(1)
+
from Products.ZPatterns.Specialists import Specialist
***************
*** 151,154 ****
--- 152,161 ----
"""
check_commit(1)
+
+ def final_commit(self):
+ """
+ do a full-final-total commit.
+ """
+ get_transaction().commit()
def findApplication(self):
|
|
From: <ssp...@us...> - 2003-06-18 19:11:22
|
Update of /cvsroot/zapp/ZApp/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv13885/tests
Modified Files:
test_MiscDataUserBase.py test_PGMiscDataUser.py
Log Message:
added propertysheet and attribute providers to ZApp_Misc data so we can more easily store attributes in other places!
Index: test_MiscDataUserBase.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/tests/test_MiscDataUserBase.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_MiscDataUserBase.py 2 Jun 2003 16:41:38 -0000 1.2
--- test_MiscDataUserBase.py 18 Jun 2003 19:11:19 -0000 1.3
***************
*** 55,58 ****
--- 55,76 ----
assert object1.safeMiscData.getXMLAttr('x','') == 'hello?'
+
+ def test_PropertySheetProvider(self):
+
+ testString = 'prop1 test'
+ mdum = self.myApp.MiscDataUsers
+ object1 = mdum.ZApp_createNewItem()
+ object1.propertysheets.get('testProps').manage_changeProperties( prop1 = testString)
+ self.mdm.commit_subtransaction()
+ try:
+ assert object1.prop1 == testString
+ except:
+ import pdb
+ pdb.set_trace()
+
+ object1.propertysheets.get('testProps').manage_changeProperties( prop1 = testString)
+
+
+
if __name__=='__main__':
raise "RuntimeError", "This is a base class for building tests using various backend levers. It can't run on it's own!"
Index: test_PGMiscDataUser.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/tests/test_PGMiscDataUser.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_PGMiscDataUser.py 2 Jun 2003 16:41:38 -0000 1.2
--- test_PGMiscDataUser.py 18 Jun 2003 19:11:19 -0000 1.3
***************
*** 11,15 ****
def setUp( self ):
MiscDataUserBase.setUp( self )
! self.myApp = getApp( self, 'GadflyZApp_Test' )
self.setUpMiscData()
--- 11,15 ----
def setUp( self ):
MiscDataUserBase.setUp( self )
! self.myApp = getApp( self, 'PGZApp_Test' )
self.setUpMiscData()
***************
*** 18,22 ****
if __name__=='__main__':
-
main(defaultTest='test_suite')
--- 18,21 ----
|
|
From: <ssp...@us...> - 2003-06-18 19:11:22
|
Update of /cvsroot/zapp/ZApp/www_ui In directory sc8-pr-cvs1:/tmp/cvs-serv13885/www_ui Added Files: attrprov.gif sheetprov.gif Log Message: added propertysheet and attribute providers to ZApp_Misc data so we can more easily store attributes in other places! --- NEW FILE: attrprov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sheetprov.gif --- (This appears to be a binary file; contents omitted.) |
|
From: <ssp...@us...> - 2003-06-18 19:11:22
|
Update of /cvsroot/zapp/ZApp
In directory sc8-pr-cvs1:/tmp/cvs-serv13885
Modified Files:
ZApp_Base.py ZApp_MiscData.py __init__.py
Log Message:
added propertysheet and attribute providers to ZApp_Misc data so we can more easily store attributes in other places!
Index: ZApp_Base.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_Base.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** ZApp_Base.py 13 Jun 2003 13:59:52 -0000 1.16
--- ZApp_Base.py 18 Jun 2003 19:11:19 -0000 1.17
***************
*** 15,18 ****
--- 15,21 ----
from Products.ZPatterns.SkinScript.Components import Trigger, Compute
from ZApp_LOG import ZApp_LOG
+ from Products.ZPatterns.DataSkins import _v_dm_
+ from Products.ZPatterns.SheetProviders import SheetProvider
+ from OFS import PropertySheets
_marker = []
Index: ZApp_MiscData.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/ZApp_MiscData.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ZApp_MiscData.py 13 Jun 2003 13:59:53 -0000 1.8
--- ZApp_MiscData.py 18 Jun 2003 19:11:19 -0000 1.9
***************
*** 4,8 ****
from Products.ZApp.ZApp_LOG import ZApp_LOG
! from xmlrpclib import dumps, loads
import ZApp_Base
--- 4,18 ----
from Products.ZApp.ZApp_LOG import ZApp_LOG
! import xmlrpclib
!
! dumps, loads = xmlrpclib.dumps, xmlrpclib.loads
!
! from Products.ZPatterns.DataSkins import _v_dm_
! from Products.ZPatterns.SheetProviders import SheetProvider
! from Products.ZPatterns.AttributeProviders import AttributeProvider
! from OFS import PropertySheets
! from Products.PlugIns import defaultConstructors
!
! from DateTime import DateTime
import ZApp_Base
***************
*** 49,58 ****
def buildXML(self):
""" create the XML to represent this object."""
! result = dumps( (self._v_xmlDict,))
! return result
def getXMLAttr(self, attr, default=None, escNL=0):
""" get an XML based attribute."""
! return self._v_xmlDict.get(attr, default)
def XMLAttrs(self):
--- 59,79 ----
def buildXML(self):
""" create the XML to represent this object."""
! try:
! self.xml = dumps( (self._v_xmlDict,))
! except:
! import pdb
! pdb.set_trace()
!
! return self.xml
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 = value.value
! if len(value)>4 and value[4] != '-':
! value = '-'.join([value[:4],value[4:6],value[6:]])
! value = DateTime(value)
! return value
def XMLAttrs(self):
***************
*** 60,69 ****
return self._v_xmlDict.keys()
! def setXMLAttr(self, attr, value):
! """ set an XML attribute to a value."""
- d = self._v_xmlDict # getting _v_xmlDict insures the cache is setup
d[attr] = value
! self.xml = self.buildXML()
def setXMLAttrs(self, dict=None, **kw):
--- 81,97 ----
return self._v_xmlDict.keys()
! def _setXMLAttr(self, attr, value, d=None):
! if d is None:
! d = self._v_xmlDict # getting _v_xmlDict insures the cache is setup
!
! if isinstance(value, DateTime):
! value = xmlrpclib.DateTime(value.timeTime())
d[attr] = value
!
! def setXMLAttr(self, attr, value):
! """ set an XML attribute to a value."""
! selt._setXMLAttr( attr, value)
! self.buildXML()
def setXMLAttrs(self, dict=None, **kw):
***************
*** 80,86 ****
for k in saveDict.keys():
! d[k] = saveDict[k]
! self.xml = self.buildXML()
def storeInXML(self, obj, attr_list):
--- 108,114 ----
for k in saveDict.keys():
! self._setXMLAttr(k, saveDict[k], d)
! self.buildXML()
def storeInXML(self, obj, attr_list):
***************
*** 158,160 ****
--- 186,427 ----
return currentBag
+ def getDataPropertyManagers(self, withID=''):
+ """
+ return a list of propertyManagers in my 'miscDataDef' class extender..
+ """
+
+ result = []
+ myDM = self.__dict__[_v_dm_]
+ for provider in getattr(myDM,myDM.DataPlugins.attr):
+ if provider.meta_type == 'DataSkin Class Extender':
+ if withID:
+ thePropManager = getattr(provider, withID, None)
+ if thePropManager:
+ result = [thePropManager]
+ break
+ else:
+ thePropManagers = filter(lambda x,ha=hasattr: ha(x,'propertyMap'), provider.objectValues())
+ result += thePropManagers
+ return result
+
+ def getMiscDataObj(self, Manager=None, dataType=''):
+ """
+ get all of my misc data objects that have my manager, objectID, and (optionally) specified data type
+ """
+
+ if Manager is None:
+ Manager = self.miscDataManager
+
+ mds = self.getMiscDataSpecialist()
+ mdobs = mds and mds.ZApp_getItems( objectID=self.id, Manager=Manager, dataType=dataType)
+ return mdobs and mdobs[0]
+
+ def getObjectInfo(self):
+ """
+ return known attributes/values for object..
+ """
+ result = {'objectID':self.getId()}
+ for p in self._properties:
+ if p['id']:
+ val = getattr(self, p['id'])
+ if p['type'] != 'string':
+ val = `val`
+ result[p['id']] = val
+
+
+ result.update( self.getMiscDataFor( 'miscAttributes' ))
+
+ return result
+
ZApp_Base.extendProperties( ZApp_MiscData, props )
+
+ missing = []
+
+ class ZApp_MiscDataPropertySheetProvider( SheetProvider ):
+
+ meta_type='ZApp MiscData Property Sheet Provider'
+
+ def _PropertySheetFor(self, client, name='', xmlns=''):
+ """
+ return a propertysheet object that takes care of some set
+ of properties
+ """
+
+ propertyManager = getattr( client, 'PropSheetFor_' + name, None)
+
+ if propertyManager:
+ mdata = client.getMiscDataObj( dataType = name )
+ if not mdata:
+ mdata = client.setupMiscData( dataType = name )
+
+ return ZApp_MiscDataPropertySheet( name,
+ propertyManager,
+ ZApp_MiscDictProxy(client=mdata, defObj=propertyManager),
+ mdata)
+
+ def _PropertySheetsFor(self, client):
+ """Return a (possibly empty) list of PropertySheet objects for client"""
+ # Note: this could include duplicate sheets if persistent sheets
+ # are defined by more than one provider!
+
+ propertyManagers = client.getDataPropertyManagers()
+ result = []
+ if propertyManagers:
+ for pm in propertyManagers:
+ result.append(self._PropertySheetFor(client, pm.getId()))
+
+ return result
+
+ class ZApp_MiscDataAttributeProvider(AttributeProvider):
+
+ def namesForRegistration(self,container):
+ """
+ Return a tuple (readnames,writenames) where each is a sequence of attribute
+ names which this attribute provider supports reading and writing, respectively.
+ '*' may be included in either or both sequences, which means the provider will
+ be called if a more specific provider could not be found for a given attribute.
+ This is so that attribute providers can potentially create attributes
+ dynamically based on the requested name.
+ """
+ return {
+ 'provides':('attributes',),
+ 'setattr': self.Attributes,
+ 'getattr': self.Attributes,
+ }
+
+ def _AttributeFor(self,client,name,default=None):
+ """
+ Look for the information in the MiscData object..
+ """
+ if name not in self.Attributes:
+ return default
+
+ propSheet = getattr(client, 'PropSheetFor_' + self.propsheetname)
+ default = getattr(propSheet, name, '')
+ mdata = client.getMiscDataObj( dataType = self.propsheetname)
+
+ if not mdata:
+ return default
+ else:
+ value = mdata.getXMLAttr(name, missing)
+ if value is missing:
+ return default
+ else:
+ return value
+
+ def _SetAttributeFor(self,client,name,value):
+ """Set the attribute and return true if successful"""
+
+ propertyManager = getattr( client, 'PropSheetFor_' + self.propsheetname, None)
+
+ if propertyManager:
+ mdata = client.getMiscDataObj( dataType = name )
+ if not mdata:
+ return 0
+ else:
+ mdata.setXMLAttr(name, value)
+ return 1
+
+ # Class Metadata
+
+ meta_type='ZApp Misc Data Attribute Provider'
+
+ Attributes = ()
+ propsheetname = ''
+
+ _properties=(
+ {'id':'title', 'type': 'string', 'mode': 'w'},
+ {'id':'propsheetname', 'type': 'string', 'mode': 'w'},
+ {'id':'Attributes', 'type':'tokens', 'mode':''},
+ )
+
+ def manage_editProperties(self, REQUEST):
+ """
+ forward the method call to our superclass... but update our 'Attributes' property
+ while we're at it!
+ """
+ result = ZApp_MiscDataAttributeProvider.inheritedAttribute('manage_editProperties')(self, REQUEST)
+ myDM = self.aq_parent
+ propManAttr = 'PropSheetFor_' + self.propsheetname
+ for provider in getattr(myDM,myDM.DataPlugins.attr):
+ if provider.meta_type == 'DataSkin Class Extender':
+ propertyManager = getattr(provider, propManAttr, None)
+
+ if propertyManager:
+ pMap = propertyManager.propertyMap()
+ self.Attributes = tuple(filter(lambda x:x, map(lambda x: x.get('id',''), pMap)))
+ return result
+ else:
+ raise RuntimeError,("Can't find propertymanager named: '%s'" % propManAttr)
+
+ class ZApp_MiscDictProxy:
+
+ def __init__(self, client=None, defObj=None):
+ if client is not None:
+ self.__dict__['client'] = client
+ if defObj is not None:
+ self.__dict__['defObj'] = defObj
+
+ def getClient(self, name='client', createIfMissing=1):
+
+ client = self.__dict__.get(name,missing)
+ if client is missing:
+ client = {}
+ if createIfMissing:
+ self.__dict__[name] = client
+ return client
+
+ def __setattr__(self, attr, value):
+ self.getClient()._setXMLAttr(attr,value)
+
+ def __getattr__(self, attr, default=None):
+ ZApp_LOG("attemptng to get attribute: " + attr)
+ val = self.getClient().getXMLAttr(attr,default)
+ if val is default:
+ val = getattr(self.getClient(name='defObj'), attr, default)
+ return val
+
+ class ZApp_MiscDataPropertySheet (PropertySheets.FixedSchema):
+
+ def __init__(self, id, base, proxy, client, md=None):
+ ZApp_MiscDataPropertySheet.inheritedAttribute('__init__')(self, id, base, md)
+ self._base=base
+ self._proxy=proxy
+ self._client=client
+
+ def v_self(self):
+ return self._proxy
+
+ def manage_editProperties(self, REQUEST):
+ """Edit object properties via the web."""
+ result = ZApp_MiscDataPropertySheet.inheritedAttribute('manage_editProperties')(self, REQUEST)
+ self._client.buildXML()
+ return result
+
+ def manage_changeProperties(self, REQUEST=None, **kw):
+ """Change existing object properties by passing either a mapping
+ object of name:value pairs {'foo':6} or passing name=value
+ parameters."""
+
+ result = apply(ZApp_MiscDataPropertySheet.inheritedAttribute('manage_changeProperties'), (self, REQUEST), kw)
+ self._client.buildXML()
+ return result
+
+
+ def initialize(context):
+
+ context.registerPlugInClass(
+ ZApp_MiscDataPropertySheetProvider,
+ permission = 'Add Sheet Providers',
+ constructors = defaultConstructors(ZApp_MiscDataPropertySheetProvider,globals()),
+ icon = 'www_ui/sheetprov.gif'
+ )
+
+ context.registerPlugInClass(
+ ZApp_MiscDataAttributeProvider,
+ permission = 'Add Attribute Providers',
+ constructors = defaultConstructors(ZApp_MiscDataAttributeProvider,globals()),
+ icon = 'www_ui/attrprov.gif'
+ )
+
+
Index: __init__.py
===================================================================
RCS file: /cvsroot/zapp/ZApp/__init__.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** __init__.py 13 Jun 2003 13:59:53 -0000 1.12
--- __init__.py 18 Jun 2003 19:11:19 -0000 1.13
***************
*** 57,60 ****
--- 57,61 ----
ZApp_Application.initialize(context)
ZApp_LeverMethods.initialize(context)
+ ZApp_MiscData.initialize(context)
context.registerHelp()
|
|
From: <ssp...@us...> - 2003-06-18 02:39:15
|
Update of /cvsroot/zapp/ZApp/leverMethods/PG
In directory sc8-pr-cvs1:/tmp/cvs-serv354/leverMethods/PG
Modified Files:
insertItemLever.plain updateItemLever.plain
Log Message:
fixed problems in PG insert/update levers with timestamp properties
Index: insertItemLever.plain
===================================================================
RCS file: /cvsroot/zapp/ZApp/leverMethods/PG/insertItemLever.plain,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** insertItemLever.plain 13 May 2003 13:48:58 -0000 1.10
--- insertItemLever.plain 18 Jun 2003 02:39:12 -0000 1.11
***************
*** 23,27 ****
'text':'string',
'boolean':'string',
! 'timestamp':'timestamp',
'string1k':'string',
}
--- 23,27 ----
'text':'string',
'boolean':'string',
! 'timestamp':'string',
'string1k':'string',
}
***************
*** 36,48 ****
for item in pm:
! theType = item.get('dbType',item.get('sqlType'))
mode = item.get('mode','')
itemID = item['id']
! theType = typeLookups.get(theType, theType)
if mode:
columnList.append(itemID)
argumentList.append('%s=""' % itemID)
! itemList.append('<dtml-sqlvar %s type="%s">' % (item['id'], theType))
templateString = templateString % (specialist.id, string.join(columnList, ',\n'), string.join(itemList,',\n'))
--- 36,52 ----
for item in pm:
! dbType = item.get('dbType',item.get('sqlType'))
mode = item.get('mode','')
itemID = item['id']
! theType = typeLookups.get(dbType, dbType)
if mode:
columnList.append(itemID)
argumentList.append('%s=""' % itemID)
! if dbType == 'timestamp':
! fmtString = ("'<dtml-var %s " % itemID) + "fmt=\"%m/%d/%Y %H:%M\" sql_quote>'"
! itemList.append(fmtString)
! else:
! itemList.append('<dtml-sqlvar %s type="%s">' % (item['id'], theType))
templateString = templateString % (specialist.id, string.join(columnList, ',\n'), string.join(itemList,',\n'))
Index: updateItemLever.plain
===================================================================
RCS file: /cvsroot/zapp/ZApp/leverMethods/PG/updateItemLever.plain,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** updateItemLever.plain 9 May 2003 12:53:08 -0000 1.6
--- updateItemLever.plain 18 Jun 2003 02:39:12 -0000 1.7
***************
*** 23,27 ****
'text':'string',
'boolean':'string',
! 'timestamp':'timestamp',
'string1k':'string',
}
--- 23,27 ----
'text':'string',
'boolean':'string',
! 'timestamp':'string',
'string1k':'string',
}
***************
*** 43,52 ****
if mode or update_template:
! theType = item.get('sqlType',item.get('dbType'))
if update_template:
itemString = update_template % item
else:
! theType = typeLookups.get(theType, theType)
! itemString = '%s = <dtml-sqlvar %s type="%s">' % (itemID, itemID, theType)
itemList.append( itemString )
--- 43,56 ----
if mode or update_template:
! dbType = item.get('sqlType',item.get('dbType'))
if update_template:
itemString = update_template % item
else:
! if dbType == 'timestamp':
! fmtString = ("'<dtml-var %s " % itemID) + "fmt=\"%m/%d/%Y %H:%M\" sql_quote>'"
! itemString = "%s = %s" % (itemID, fmtString)
! else:
! theType = typeLookups.get(dbType, dbType)
! itemString = '%s = <dtml-sqlvar %s type="%s">' % (itemID, itemID, theType)
itemList.append( itemString )
|