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> but there are two problems here: 1) Apparently I can't slice in DTML; 2) The expression "folder==lang" evaluates the literal strings, not the variables. 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? for property in propertyIds(): or do I need *context.propertyIds()*? TIA, beno
beno wrote:
This is becoming far_more_complex than I anticipated. I would love to be able to do something like this:
I don't know what you want to do, but please try it this way: <dtml-let lang="REQUEST.get('HTTP_ACCEPT_LANGUAGE','en-us')"> <dtml-in objectValues> <dtml-let langShort="lang[2:]"> <dtml-var langShort> <dtml-if expr="getId()==langShort"> <dtml-var sequence-item> </dtml-if> </dtml-let> </dtml-in> </dtml-let> -mj
At 07:52 PM 1/15/2003 +0100, you wrote:
beno wrote:
This is becoming far_more_complex than I anticipated. I would love to be able to do something like this:
I don't know what you want to do, but please try it this way:
<dtml-let lang="REQUEST.get('HTTP_ACCEPT_LANGUAGE','en-us')"> <dtml-in objectValues> <dtml-let langShort="lang[2:]"> <dtml-var langShort> <dtml-if expr="getId()==langShort"> <dtml-var sequence-item> </dtml-if> </dtml-let> </dtml-in> </dtml-let>
Okay, I think I'm almost there :) Here's what I've got now: <dtml-let lang="REQUEST.get('HTTP_ACCEPT_LANGUAGE','en-us')"> <dtml-in objectValues> <dtml-let langShort="lang[:2]"> <dtml-let x=getId> <dtml-let y="x[:2]"> langShort: <dtml-var langShort> y: <dtml-var y> <dtml-if expr="y==langShort"> Why does this print now??? <dtml-var y> </dtml-if> </dtml-let> </dtml-let> </dtml-let> </dtml-in> </dtml-let> The strange (to me) thing is, if I don't have the *langShort:* and *y:* print statements, then *Why does this...* doesn't print! But if I do have them, then it does! Obviously, I would like things to work without having unnecessary print statements. What am I missing? TIA, beno
participants (2)
-
beno -
Maik Jablonski