[Twisted-web] [Nevow] inevow.IQ
Manlio Perillo
manlio_perillo at libero.it
Tue Jul 25 10:29:53 CDT 2006
Jean-Paul Calderone ha scritto:
> On Tue, 25 Jul 2006 12:51:30 +0200, Manlio Perillo
> <manlio_perillo at libero.it> wrote:
>> Hi.
>>
>> In the interface IQ there is a keyed method but it seems that this is
>> not implemented.
>> What about it?
>
> It looks like a very strange operation to me. It should probably be
> removed from the interface.
>
It is not the only strange thing in Nevow source code ;-).
>>
>> It is documented also in stan.py (where there are some other special
>> stuff like remember).
>>
>
> It is? I can't see any references to it except for on the IQ definition.
>
nevow.stan.Tag
def __call__(self, **kw):
"""Change attributes of this tag. This is implemented using
__call__ because it then allows the natural syntax::
table(width="100%", height="50%", border="1")
Attributes may be 'invisible' tag instances (so that
C{a(href=invisible(data="foo", render=myhrefrenderer))} works),
strings, functions, or any other object which has a registered
flattener.
If the attribute is a python keyword, such as 'class', you can
add an underscore to the name, like 'class_'.
A few magic attributes have values other than these, as they
are not serialized for output but rather have special purposes
of their own:
- data: The value is saved on the context stack and passed to
render functions.
- render: A function to call that may modify the tag in any
way desired.
- remember: Remember the value on the context stack with
context.remember(value) for later lookup with
context.locate()
- pattern: Value should be a key that can later be used to
locate this tag with context.patternGenerator() or
context.allPatterns()
- key: A string used to give the node a unique label. This
is automatically namespaced, so in
C{span(key="foo")[span(key="bar")]}
the inner span actually has a key of 'foo.bar'. The key is
intended for use as e.g. an html 'id' attribute, but will
is not automatically output.
- macro - A function which will be called once in the lifetime
of the template, when the template is loaded. The return
result from this function will replace this Tag in the template.
"""
>>
>> By the way: what's the difference, say, beetwen
>> ctx.fillSlots(...) and inevow.IQ(ctx).fillSlots(...)
>> ?
>
> Not a lot.
An overhead for the adaptation?
> Neither should be used, though. Use tag.fillSlots(...)
> instead.
>
Right, thanks.
But it is strange: why I do not get deprecation warnings?
Thanks and regards Manlio Perillo
More information about the Twisted-web
mailing list