[Zope] dtml-with question
Marie Robichon
robichon@esrf.fr
Fri, 23 Aug 2002 17:09:41 +0200
--=====================_6475789==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
>
>hi,
>
>your error is in the dtml-with... myid is a string and not an object:
>
> > <dtml-call "manage_addFolder(myid, mytitle)">
> >
> > <dtml-with myid>
>
>so try something like this to get the object with id=myid:
>
><dtml-with "_.getattr(this(),myid)">
>
>-maik
>
Thanks but I seem to be getting an attribute error __getslice__ when I try
to do this:
<dtml-let dictionaryvar="filescript(REQUEST)">
<dtml-if "not dictionaryvar.has_key('file')">
<dtml-call "RESPONSE.redirect('fileform?nofile=1')">
<dtml-else>
<dtml-let mytitle="dictionaryvar['title']"
body="dictionaryvar['body']" myid="dictionaryvar['fid']" >
<dtml-with "ContentHolder.createInObjectManager(myid,REQUEST)">
<dtml-call
"propertysheets.general.manage_changeProperties(title=mytitle)">
<dtml-with "_.getattr(this(),myid)">
<dtml-call
"manage_addProduct['PageTemplates'].manage_addPageTemplate('contents_html',
mytitle, body)">
<dtml-call "manage_addFolder('img','my images')">
</dtml-with>
</dtml-with>
</dtml-let>
</dtml-if>
</dtml-let>
and following Chris Withers advice and using a python script:
theDict = context.filescript(context.REQUEST)
mytitle = theDict['title']
body = theDict['body']
myid = theDict['fid']
dispatcher = context.manage_addProduct['ContentHolder']
dispatcher.manage_addContentHolder(myid,mytitle)
myproduct=context[myid]
myproduct.manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html',mytitle,body)
I get an attribute error Error Type: AttributeError
Error Value: manage_addContentHolder
I know that it would be better to do a product that using zclasses and that
is our next step but I would like to be able to get this working before I
tackle that big step...
TIA
Marie
--=====================_6475789==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<blockquote type=cite class=cite cite><br>
hi,<br>
<br>
your error is in the dtml-with... myid is a string and not an
object:<br>
<br>
> <dtml-call "manage_addFolder(myid, mytitle)"><br>
><br>
> <dtml-with myid><br>
<br>
so try something like this to get the object with id=myid:<br>
<br>
<dtml-with "_.getattr(this(),myid)"><br>
<br>
-maik<br>
<br>
</blockquote><br>
Thanks but I seem to be getting an attribute error __getslice__ when I
try to do this:<br>
<br>
<dtml-let dictionaryvar="filescript(REQUEST)"><br>
<dtml-if "not
dictionaryvar.has_key('file')"><br>
<dtml-call
"RESPONSE.redirect('fileform?nofile=1')"><br>
<dtml-else><br>
<dtml-let
mytitle="dictionaryvar['title']"
body="dictionaryvar['body']"
myid="dictionaryvar['fid']" ><br>
<dtml-with
"ContentHolder.createInObjectManager(myid,REQUEST)"><br>
<dtml-call
"propertysheets.general.manage_changeProperties(title=mytitle)"><br>
<dtml-with "_.getattr(this(),myid)">
<br>
<dtml-call
"manage_addProduct['PageTemplates'].manage_addPageTemplate('contents_html',
mytitle, body)"><br>
<dtml-call "manage_addFolder('img','my images')"><br>
</dtml-with><br>
</dtml-with><br>
</dtml-let><br>
</dtml-if><br>
</dtml-let><br>
<br>
and following Chris Withers advice and using a python script:<br>
<br>
theDict = context.filescript(context.REQUEST)<br>
mytitle = theDict['title']<br>
body = theDict['body']<br>
myid = theDict['fid']<br>
dispatcher = context.manage_addProduct['ContentHolder']<br>
dispatcher.manage_addContentHolder(myid,mytitle)<br>
myproduct=context[myid]<br>
myproduct.manage_addProduct['PageTemplates'].manage_addPageTemplate('index_html',mytitle,body)<br>
<br>
I get an attribute error <b>Error Type: AttributeError<br>
Error Value: manage_addContentHolder<br>
<br>
I know that it would be better to do a product that using zclasses and
that is our next step but I would like to be able to get this working
before I tackle that big step...<br>
<br>
TIA<br>
<br>
Marie<br>
<br>
</b></html>
--=====================_6475789==_.ALT--