[Zope] DTML Question Continued

beno zope@thewebsons.com
Thu, 16 Jan 2003 05:25:46 -0400


At 11:36 PM 1/15/2003 +0100, you wrote:
>beno wrote at 2003-1-15 04:26 -0400:
>  > This is becoming far_more_complex than I anticipated. I would love to be
>  > able to do something like this:
>  >
>  > <dtml-let lang="REQUEST.get('HTTP_ACCEPT_LANGUAGE','en-us')">
>  >   <dtml-in objectValues>
>  >    <dtml-let folder=id>
>  >     <dtml-let langShort=lang[2:]>
>  >      <dtml-var langShort>
>  >      <dtml-if expr="folder==lang">
>  >       <dtml-var lang>
>  >      </dtml-if>
>  >     </dtml-let>
>  >    </dtml-let>
>  >   </dtml-in>
>  > </dtml-let>
>This cries for an implementation in a Python script!

Probably. But I'm this close to getting it in DTML, so I'll finish up with 
that, then look at a Python script.


>  > but there are two problems here:
>  > 1) Apparently I can't slice in DTML;
>You can but you should use "..." on the right side of "=" (in "dtml-let")
>when it is an expression.
>
>I suggest again some background reading....

I've done as you've suggested. I may not use this, but I'd like to gain 
some understanding in my continual struggle to advance, nanometer by 
nanometer up the long, steep learning curve. Unfortunately, there are no 
examples in Appendix A for the use of:
namespace([name=value]...)
Would you kindly provide one?

>  > The second problem is probably far less difficult than the first. The 
> first
>  > seems to necessitate I do this as a Python script. That being the 
> case, it
>  > seems logical to do the objectValues iteration in the same script. So, 
> how
>  > do I do that? Looking at Appendix B, I find *propertyIds()* as a likely
>  > method. What would my syntax be? Something like this?
>You want read some Python introduction.
>
>The Python Tutorial is said to be very good...
>
>The iteration will look like
>
>     for obj in context.objectValues():

That is just the part I wanted. I'm still a little foggy on this *context* 
stuff.
Thanks,
beno