[Petal] Re: Using Test::More
Evan Simpson
evan at 4-am.com
Wed Apr 9 15:39:47 BST 2003
Fergal Daly wrote:
>>I think it should always fetch the local variable first. 'local' is
>>misleading for us Perl freaks, I think we should be really read it as 'my'.
>
>
> Sounds right to me, I'd like to find out what Zope does but I don't have it
> installed.
In ZPTs, "inner" definitions override "outer" definitions,
element-containment-wise. If a definition is local, its scope is the
element on which it is defined. Global definitions extend to the end of
the document. In either case, enclosed elements may further override
the definition.
Example:
<div tal:define="v1 string:1;v2:string:2;v3:string:3;no string:no">
<div tal:define="a v1;b v1" tal:attributes="a a;b b">
<div tal:define="a v2;global b v2" tal:attributes="a a;b b">
<div tal:define="a v3;b v3" tal:attributes="a a;b b">
<span tal:attributes="a a;b b"></span>
</div>
<span tal:attributes="a a;b b"></span>
</div>
<span tal:attributes="a a;b b"></span>
</div>
<span tal:attributes="a a | no;b b | no"></span>
</div>
becomes:
<div>
<div a="1" b="1">
<div a="2" b="2">
<div a="3" b="3">
<span a="3" b="3"></span>
</div>
<span a="2" b="2"></span>
</div>
<span a="1" b="2"></span>
</div>
<span a="no" b="2"></span>
</div>
>>I think ;; is a mistake.
>
> I defintely agree with you, ;; makes the parsing much trickier.
In retrospect, I agree. Things would be much easier if we had adopted a
simple uniform escape mechanism.
Apropos of nothing in particular, I'd like to mention some recent
planning over in ZPT-land that may be of interest to PETALlers:
This is by no means finalized, but we've been discussing a mechanism for
declaring "path filter" namespaces. These are probably best explained
by example: an object 'foo' has both Dublin Core attributes and
attributes from a locally defined point-of-sale schema. The Dublin core
title would be accessed as 'foo/dc:title', the upc code as
'foo/pos:upc', and the retail price (localized as a currency string) as
'foo/pos:price/format:currency'. The namespaces 'dc', 'pos', and
'format' are independent of, and have nothing to do with, the XML
namespaces of the document and the defined variables. The 'dc'
namespace may be defined by a statement such as 'tal:namespaces="dc
http://purl.org/dc/elements/1.1/"', while the non-standard 'pos' and
'format' namespace might be defined using implementation-dependent URIs,
such as 'tal:namespaces="pos tns:myApp/PointOfSale;format
tns:Utility/NumericFormatting"'. A possible implementation would be to
have each namespace correspond to an interface, and to an adapter object
whose methods operate on that interface.
Cheers,
Evan @ 4-am
More information about the Petal
mailing list