how to pass <dtml-var sequence-item> to an external method from D TML?
Hi Folks, I'm trying to surface self description methods on some code into a quick UI in Zope. Short of conforming to the Zope product spec, external methods seem like the way to go since I'm making remote method calls on the back-end (Python Script objects won't cut it). I have 2 methods: one that returns a list of the attributes available on my remote object; and one that takes the name of an attribute and returns some descriptive text about that attribute. For a simple test, I'm sucking all available attributes out of my remote object, then looping through them to get a description for each one: <dtml-in getPropNames> <dtml-var sequence-item> <dtml-var getPropDescription("<dtml-var sequence-item>")> </dtml-in> Which throws the message: Invalid attribute name, """, for tag <dtml-var getPropDescription("<dtml-var sequence-item>")> I've tried some variations on the syntax, including using <dtml-let>, with absolutely no success, and seem to be missing the boat. Am I overlooking some detail of the syntax, or just conceptualizing the design wrong? Please help. Feel free to use the words "Ha!" and "fool". Thanks in advance, John John Manchester Computational Design & Informatics Senior Scientist ArQule, Inc. tel: 781-994-0317 19 Presidential Way fax: 781-994-0679 Woburn, MA 01801 jmanchester@arqule.com www.arqule.com
<dtml-in getPropNames> <dtml-var sequence-item> <dtml-var getPropDescription("<dtml-var sequence-item>")> </dtml-in>
Which throws the message: Invalid attribute name, """, for tag <dtml-var getPropDescription("<dtml-var sequence-item>")>
DTML can either use things in its namespace or expressions, which are little bits of Python. DTML is, unsurprisingly, not parsed in expressions. You're familiar with things like <dtml-var property>. Expressions are like <dtml-var expr="arbitrarystuff()">, which is also exactly like <dtml-var "arbitrarystuff()">, but shorter. Those are the only ways to call things in DTML. You can't mix and match, lest you drive the parser mad. In your case, it would be:: Fool, the properties and thier descriptions are <dtml-in getPropNames> <dtml-var sequence-item> <dtml-var "getPropDescription(sequence-item)"> </dtml-in>. Ha! --jcc (foolha?)
J. Cameron Cooper wrote:
<dtml-in getPropNames> <dtml-var sequence-item> <dtml-var getPropDescription("<dtml-var sequence-item>")> </dtml-in>
Which throws the message: Invalid attribute name, """, for tag <dtml-var getPropDescription("<dtml-var sequence-item>")>
DTML can either use things in its namespace or expressions, which are little bits of Python. DTML is, unsurprisingly, not parsed in expressions.
You're familiar with things like <dtml-var property>. Expressions are like <dtml-var expr="arbitrarystuff()">, which is also exactly like <dtml-var "arbitrarystuff()">, but shorter. Those are the only ways to call things in DTML. You can't mix and match, lest you drive the parser mad.
In your case, it would be::
Fool, the properties and thier descriptions are <dtml-in getPropNames> <dtml-var sequence-item> <dtml-var "getPropDescription(sequence-item)"> </dtml-in>. Ha!
--jcc (foolha?)
But of course, that will not work, either. <dtml-var "getPropDescription(sequence-item)"> will fail because python will try to subtract item from sequence before passing the argument. You can either <dtml-var "getPropDescription(_['sequence-item'])"> or use dtml-let to set sequence-item to something without a dash. -- Jim Washington
But of course, that will not work, either.
<dtml-var "getPropDescription(sequence-item)"> will fail because python will try to subtract item from sequence before passing the argument.
You can either <dtml-var "getPropDescription(_['sequence-item'])"> or use dtml-let to set sequence-item to something without a dash.
Oh rats. Blasted special cases. What's the big idea not using underscores anyway? --jcc (proofread, fool)
On 6/8/01 10:49 pm, "J. Cameron Cooper" <jccooper@rice.edu> wrote:
But of course, that will not work, either.
<dtml-var "getPropDescription(sequence-item)"> will fail because python will try to subtract item from sequence before passing the argument.
You can either <dtml-var "getPropDescription(_['sequence-item'])"> or use dtml-let to set sequence-item to something without a dash.
Oh rats. Blasted special cases. What's the big idea not using underscores anyway?
--jcc (proofread, fool)
Oh dear, here comes the 'Tinos Patch' thread all over again... (archives, roughly February of this year). tone -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
Hi, --On Montag, 6. August 2001 15:51 -0500 "J. Cameron Cooper" <jccooper@rice.edu> wrote:
<dtml-in getPropNames> <dtml-var sequence-item> <dtml-var getPropDescription("<dtml-var sequence-item>")> </dtml-in>
Which throws the message: Invalid attribute name, """, for tag <dtml-var getPropDescription("<dtml-var sequence-item>")>
DTML can either use things in its namespace or expressions, which are little bits of Python. DTML is, unsurprisingly, not parsed in expressions.
You're familiar with things like <dtml-var property>. Expressions are like <dtml-var expr="arbitrarystuff()">, which is also exactly like <dtml-var "arbitrarystuff()">, but shorter. Those are the only ways to call things in DTML. You can't mix and match, lest you drive the parser mad.
In your case, it would be::
Fool, the properties and thier descriptions are <dtml-in getPropNames> <dtml-var sequence-item> <dtml-var "getPropDescription(sequence-item)">
nearly. The problem is the sequence-item. so "getPropDescription(_['sequence-item'])"> will work.
</dtml-in>. Ha!
Eventually ZPT (Zope Page Templates) make more fun here :) Regards Tino
participants (5)
-
J. Cameron Cooper -
Jim Washington -
Manchester, John -
Tino Wildenhain -
Tony McDonald