How would I go about using manage_addPageTemplate to add a template in a directory other than the one the script is called in? For example, my folder tree looks like this: Root Folder1 (Public access) Folder2 (Private, secured access) acl_users addpageform (Page Template which is my form) addpage (Script Python) Once someone authenticates in Folder 2 and submits the addpage form to the Python script, I want the script to add a PageTemplate to Folder1 I've already got the file adding part, I just need to know how to modify the path. code: item = context.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, text="blah", title="my title") Creates a new PageTemplate with the ID I specified in Folder1. I think I'm a little confused as to whether this template thats created is part of the file system, or the ZopeDB--a regular ol' "../Folder1/" + id didn't seem to work for an ID. Any help is appreciated. I've looked through the ZopePageTemplate.py file, it doesn't seem as there is an option to specify a different path (admittedly, I'm new to this and I may not be looking in the right place).
Jay Dorsey wrote:
How would I go about using manage_addPageTemplate to add a template in a directory other than the one the script is called in? For example, my folder tree looks like this:
<snip>
item = context.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, text="blah", title="my title") <snip> Figured it out--doh!
context.Folder1.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, text="blah", title="my title") What clued me in was a "how to" I found on zdp.zope.org that showed how to move objects between folders: what = context.manage_cutObjects(ids=['objecttobemoved']) context.somefolder.anotherfolder.manage_pasteObjects(what) Sometimes its right in front of you :) Also, I just found the Zope Documentation Projects FAQ section (http://zdp.zope.org/projects/zfaq). I wonder how many people are on the ZDP team; there seems to be maybe 100 questions there--I know I've asked that many in the last week alone ;-) The page says the FAQ is outdated, is there any movement for an updated version of a Zope FAQ/Snippets site? I'd just as soon chip in my effort and contribute to an existing project, than start my own. Thanks, Jay
Jay Dorsey wrote:
How would I go about using manage_addPageTemplate to add a template in a directory other than the one the script is called in? For example, my folder tree looks
item = context.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, text="blah", title="my title")
<snip> Figured it out--doh!
context.Folder1.manage_addProduct['PageTemplates'].manage_addPageTemplate(id, text="blah", title="my title")
...
Sometimes its right in front of you :)
Yep. The thing to remember is that 'context' is just a name for the folder you're called on, and that any folder will do.
Also, I just found the Zope Documentation Projects FAQ section (http://zdp.zope.org/projects/zfaq). I wonder how many people are on the ZDP team; there seems to be maybe 100 questions there--I know I've asked that many in the last week alone ;-)
The page says the FAQ is outdated, is there any movement for an updated version of a Zope FAQ/Snippets site? I'd just as soon chip in my effort and contribute to an existing project, than start my own.
The ZopeLabs cookbook is the main hangout for code snippets. As for the FAQ: not that I know of, but there's plenty of buzz surrounding the concept recently. I've been threatening to make a "library" of knowledge from the list for a little while: I guess it's not much of an extension of the idea (and code!) to a FAQ site like you're talking about. (The actual development is a pretty simple task, actually, but there are administrative obstacles to overcome before I could do actual work. But the real work is in the content.) Your issue above would fit well on zopelabs.com. Go file a recipe! --jcc
participants (2)
-
J Cameron Cooper -
Jay Dorsey