hi, I'm trying to make a product/factory that produces a dtml document with certain properties. I follow the tutorial so far, but how do I do the equivalent of: <dtml-with "manage_clone(Home,REQUEST['new_id'],REQUEST)"> with just a document? I don't see anything like manage_clone for documents in the ZQR. In other words- I have a form, that I want to generate new Documents that get their contents from their properties. -- Ethan "mindlace" Fremen webworker
First Method: This is the form that is filled in.... <!--#var standard_html_header--> <!--#var endOfSideBar--> <H2><!--#var title_or_id--> <!--#var document_title--></H2> <form action='Builder' method='post' enctype='multipart/form-data'> <TABLE CELLSPACING="2"> <TR> <TH ALIGN="LEFT" VALIGN="TOP">Id:</TH> <TD ALIGN="LEFT" VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="newId" SIZE="40"> </TD></TR> <TR> <TH ALIGN="LEFT" VALIGN="TOP">Table Rows:</TH> <TD ALIGN="LEFT" VALIGN="TOP"> <textarea NAME="newTableRows:lines" ROWS="3" COLS="40"> </textarea> </TD></TR> <TR><TD></TD> <TD><BR> <INPUT TYPE="SUBMIT" VALUE="Create Home Page"> </TD></TR> </TABLE></FORM> <!--#var standard_html_footer--> //************************* This is the second method, it builds the "clone" //******************************** <!--#var standard_html_header--> <!--#var endOfSideBar--> <!--#with "manage_clone(Home,REQUEST['newId'],REQUEST)"--> <!--#with "index_html"--> <!--#call "manage_changeProperties(tableRows=REQUEST['newTableRows'])"--> <!--#/with--> <!--#/with--> <!--#call "RESPONSE.redirect('manage_main?update_menu=1')"--> Congratulations! <!--#var standard_html_footer--> Hope this helps, DR
Dan Rusch wrote: <snip>
//************************* This is the second method, it builds the "clone" //******************************** <snippage> <!--#with "manage_clone(Home,REQUEST['newId'],REQUEST)"--> Hope this helps,
Dan, thanks, but what I'm trying to achieve here is not a method/document within a cloned folder (Home) where the folder has the properties in question, but a cloned document where the document itself has the properties to which I assign values. the with statement AFAIK basically means you make a clone of Home, give it a method with id new_id, then assign values for the folder's properties using <dtml-call>. -- ~mindlace
Ethan Fremen wrote:
Dan, thanks, but what I'm trying to achieve here is [...] a cloned document where the document itself has the properties to which I assign values.
Whohoo! I knew the new ZQR would save me! Thanks, Brian, David, Evelyn and Stephen! the answer is that manage_clone(ob,id,[REQUEST]) works on any object. So, for this case, you just use manage_clone(template_id,REQUEST=['new_id'],REQUEST) and it works fine. (this won't, of course, work for methods 'cuz they can't have their own properties) So, hehee, it works! I was struggling with Zope and felt like giving up, but now... I can use a variation of this product extensively throughout my page, giving the 'any idiot can update' feature I promised... I know it's a basic thing, but now I think I understand the object approach better, and can start to see how to leverage it. Thank you Zopistas! ... However, not everything worked... Why does this bit:<dtml-call "RESPONSE.redirect('manage_main?update_menu=1')"> result in not found? The file does exist, and has all the appropriate properties. If I do /path/to/created/document/manage_main?update_menu=1 everything works fine. Traceback (innermost last): File /usr/local/src/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /usr/local/src/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 179, in publish File /usr/local/src/Zope-2.0.0-src/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook (Object: RoleManager) File /usr/local/src/Zope-2.0.0-src/lib/python/ZPublisher/Publish.py, line 151, in publish File /usr/local/src/Zope-2.0.0-src/lib/python/ZPublisher/BaseRequest.py, line 426, in traverse File /usr/local/src/Zope-2.0.0-src/lib/python/AccessControl/User.py, line 373, in validate (Object: RoleManager) File /usr/local/src/Zope-2.0.0-src/lib/python/ZPublisher/HTTPResponse.py, line 510, in notFoundError NotFound: (see above) ... the source says a funny... <!-- who knows! --> -- Ethan "mindlace" Fremen webworker
Ethan Fremen wrote:
However, not everything worked... Why does this bit:<dtml-call "RESPONSE.redirect('manage_main?update_menu=1')">
result in not found?
well, first, the second part of the tutorial adds DocumentURL(), which is, of course, case sensitive. Second, it's just the url to the folder you're in, so (if the document was created with the id variable "new_id") "RESPONSE.redirect(DocumentURL()+'/'+new_id)" is the right answer. Now to write up a little HOW-To. -- ~mindlace
mindlace wrote
Dan, thanks, but what I'm trying to achieve here is not a method/document within a cloned folder (Home) where the folder has the properties in question, but a cloned document where the document itself has the properties to which I assign values.
Maybe I'm not fully understanding, but the HomeBuilder does create a cloned document (index_html) where the document itself has the properties to which where assign values (tableRows) in the HomeBuilder. This new document is created in the folder you name in the "id" field of the HomeBuilder. Note: We have built a framework that can generate virtually any web page we need based on properties assigned to the page. This framework is made up of a series of dtml tags and wrapped in one tag. The "HomeBuilder" type of technology allows us to create a mind boggling array of pages without writing any code. The developer simply fills out the "HomeBuilder" form (the actual form is of course much more complicated) and the Builder Method then creates the page with the requested properties in the designated folder. Hope this helps. DR
participants (2)
-
Dan Rusch -
Ethan Fremen