Re: [Zope] another "issue.1999.01"-Problem
Martijn Pieters <mj@antraciet.nl> writes:
works as expected. Is sequence-item not a string in the above example?
sequence-item is two variables in Python: sequence minus item. Use _['sequence-item'] instead.
So I was explaining this to someone here the other day(after I had told them what legal ZOPE variables were) and an obvious question is "well since these are so common why do they have illegal zope variable names?" Is it historical? Also would it be possible to have copies of the varaibles availiable with names such as sequence_item in future releases? -Chris walter@budoe.bu.edu
Chris Walter wrote:
Martijn Pieters <mj@antraciet.nl> writes:
works as expected. Is sequence-item not a string in the above example?
sequence-item is two variables in Python: sequence minus item. Use _['sequence-item'] instead.
thanks for the answer, this was of course a FAQ ;-)
So I was explaining this to someone here the other day(after I had told them what legal ZOPE variables were) and an obvious question is "well since these are so common why do they have illegal zope variable names?" Is it historical? Also would it be possible to have copies of the varaibles availiable with names such as sequence_item in future releases?
I personally never liked this illegal names, Would be nice to have them as sequence_item,... Today seems my problem day: :-) After getting answers for all this problems of course I have another one I want to delete the image-object with id="banner" in the "Wo"-Folder ("Wo" means "Where" in German) e.g. <dtml-call "manage_delObjects(ids=['banner'])"> . <dtml-if "_.hasattr(Wo, 'banner')"> does not work as a condition, because Aquisition takes place. I have an object banner at the root-directory! Question: What is the correct was of programming the following: Delete an image with id="banner" in a certain Folder named "Wo", but only if there is really one contained there (Aquisition is not allowed). I really tried all kind af namespace-manipulations here, also the _.None.. stuff, but I can't find a solution. -- Tom - a little bit confused and sorry for all this questions..
well, after some strugling here is my final solution for what I wanted to do. Maybe this is of some use for somebody (not really difficult although I had a hard time getting it). The Input form get the variables Kundenid, Wo, MyURL, and file: (Replace "Wo" by "Where" and "Kundenid" by "customerid" if you prefer that) ------------------------------------------------------------- <dtml-var standard_html_header> <br> your banner-placement in the directory <a href="<dtml-var BASE0>/<dtml-var Wo>">/<dtml-var Wo></a> <dtml-if "Wo == ''"> <dtml-call "REQUEST.set('Wo', PARENTS[-1])"> <dtml-elif "_.string.find(Wo, '/') == -1"> <dtml-call "REQUEST.set('Wo', _.getattr(PARENTS[-1], Wo))"> <dtml-else> <dtml-in "_.string.split(Wo, '/')"> <dtml-if sequence-start> <dtml-call "REQUEST.set('Wo', _.getattr(PARENTS[-1], _['sequence-item']))"> <dtml-else> <dtml-call "REQUEST.set('Wo', _.getattr(Wo, _['sequence-item']))"> </dtml-if> </dtml-in> </dtml-if> <dtml-with Wo> <dtml-if "'banner' in objectIds()"> <dtml-call "manage_delObjects(ids=['banner'])"> </dtml-if> <dtml-call "manage_addImage(id='banner',file=file)"> <dtml-call "banner.manage_addProperty('url', MyURL, 'string')"> <dtml-call "banner.manage_addProperty('Kundenid', Kundenid, 'int')"> </dtml-with> was successfull! <dtml-var standard_html_footer> -- Tom
participants (2)
-
Chris Walter -
Tom Schwaller