I am using Formulator(which requires a tuple) to create a list of objects and still learning python scripts. and stuck. I am trying to create a master script to exist in Root that will create a list of objects from a Folder with a given ObjectType. like zClasses, DTML_Methods, or DTML_Docs. script- tuple_of_items called in Override ##parameters=myFolder, myObjectType results=[] for object in container.myFolder.objectValues('myObjectType'): tuple = object.title, object.id results.append(tuple) return results in the Items Override I enter>> tuple_of_items('idofTargetFolder','DTML_Method') I get an attribute error. Please help me with what I have missed? If I dont pass the parameters and hardcode in the script: The form renders properly, but on Submit, I get the error>> unknown_selection You selected an item that was not in the list. What is causing this? Thank you, Trevor
Trevor Toenjes writes:
I am trying to create a master script to exist in Root that will create a list of objects from a Folder with a given ObjectType. like zClasses, DTML_Methods, or DTML_Docs.
script- tuple_of_items called in Override
##parameters=myFolder, myObjectType results=[] for object in container.myFolder.objectValues('myObjectType'): Almost surely, you mean:
for object in container.myFolder.objectValues(myObjectType): Otherwise, you look for the literal "myObjectType" and not for the passed in parameter. Dieter
participants (2)
-
Dieter Maurer -
Trevor Toenjes