creating object in local dir from add form in product dir
I am developing several ZClasses in a Products dir. I want managers to be able to instantiate some of the ZClasses from the /manage interface and users to be able to instantiate others from a non-manage URL. Users will access http://some.host:8080/path/to/MedBio305 where MedBio305 is an instance of my ZClass Course which has a Method index_html that allows users to view the folder. Within that index_html file, I have some links which point to the add form of a Project ZClass that I want users to be able to instantiate: <a href="/Control_Panel/Products/Course/Project_addForm>upload</a></td> My Project_addForm calls a python script add method. I want that script to instantiate a Project ZClass in /path/to/MedBio305/, but context.Project.createInObjectManager(pid,REQUEST) doesn't work because the /Control_Panel/Products/Course/ dir is the current context for this script. Can someone advise how to create the instance in the MedBio305 dir? I suspect the answer lies in using the BASEn, URLn, special variables of the REQUEST object, but don't know enough about the Zope API to work it out. Thanks, John Hunter
"John" == John Hunter <jdhunter@ace.bsd.uchicago.edu> writes:
John> I am developing several ZClasses in a Products dir. I want John> managers to be able to instantiate some of the ZClasses from John> the /manage interface and users to be able to instantiate John> others from a non-manage URL. Users will access John> http://some.host:8080/path/to/MedBio305 John> where MedBio305 is an instance of my ZClass Course which has John> a Method index_html that allows users to view the folder. John> Within that index_html file, I have some links which point John> to the add form of a Project ZClass that I want users to be John> able to instantiate: John> <a John> href="/Control_Panel/Products/Course/Project_addForm>upload</a></td> John> My Project_addForm calls a python script add method. I want John> that script to instantiate a Project ZClass in John> /path/to/MedBio305/, but OK, the example on p139-140 of The Zope Book where a SmallAnimals/kangarooMouse has the Zoo/Vet/vaccinate script applied to it solved this one for me. <a href="Control_Panel/Products/Course/path/to/MedBio305/Project_addForm>upload</a></td> works because the last object before the script is the context, in this case MedBio305 Cheers, John Hunter
participants (1)
-
John Hunter