[Zope] Namespace + syntax question
Tres Seaver
tseaver@palladion.com
Tue, 15 Feb 2000 11:18:23 -0600
Evan Simpson wrote:
>
> ----- Original Message -----
> From: Tres Seaver <tseaver@palladion.com>
> > I usually end up throwing in a '<dtml-let ...>' to alias those ridiculous
> > "identifiers". What is the status of the patch to alias them
> automatically (I
> > _still_ can't figure out why they exist)?
>
> One thing I find myself often wanting is the ability to do this:
>
> <dtml-in expr="arg.bargle[mumble](frotz)" sequence-var=fred>
> <dtml-in expr="fred.item(3)">
> <dtml-var fred/index>: <dtml-var fred/key> <dtml-var sequence-item>
> </dtml-in>
> </dtml-in>
'<dtml-var fred/index>'??? Are you using some bleading-edge CVS checkout that
makes the "/" work like that? Anyway, I think the notion of a "brains"/iterator
object makes sense. It would have the properties:
name= expr= Semantics
========= =========== ================================================
- fred-item fred.item "Unwrap" the object, like 'sequence-item'
- fred-index fred.index Like 'sequence-index'
- fred-isStart fred.isStart Like 'sequence-start' (renamed to show predicate)
- fred-isEnd fred.isEnd Like 'sequence-end' (renamed to show predicate)
and any of the others in the current "sequence-blah" set. The
'sequence-var-nnn' bit could be handled
through pure dictionary-style lookup (fred[ 'nnn' ]), or through mangling the
identifier (fred-var-nnn). The mapping keyword would set a flag on fred which
caused any non-standard getattr to delegate to the wrapped item (or is that
getitem?). We could even call the default brains object "sequence", to maintain
backward compatibility.
>
> ...instead of...
>
> <dtml-in expr="arg.bargle[mumble](frotz)">
> <dtml-let fred_index=sequence-index fred_item=sequence-item
> fred_key=sequence-key>
> <dtml-in expr="fred_item(3)">
> <dtml-var fred_index>: <dtml-var fred_key> <dtml-var sequence-item>
> </dtml-in>
> </dtml-let>
> </dtml-in>
>
> What do you think?
>
> Cheers,
>
> Evan @ digicool
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com