[Twisted-web] Trouble chaining Javascript module calls in Athena
(example code attached).
kgi
iacovou at gmail.com
Wed May 30 11:53:47 EDT 2007
On Wednesday 30 May 2007 18:12:32 Jean-Paul Calderone wrote:
> Something about this approach rubs me the wrong way. Identifiers which are
> required to be globally unique sends one down the path of being limited to
> only supporting certain page configurations. Maybe if there were some well
> defined algorithm for choosing the "nearest" widget with a given
> identifier, something could be worked out. I'm not too sure about this
> either, though.
Is it the resultant uniqueness or the interdependency that worries you?
I can see why this would be icky if the unique widget name were somehow
hard-coded into the LiveElement class definition (meaning you could only
create one such widget) but I don't see how it would be in any way harmful or
limiting if the unique widget identifier were specified at widget
construction time. Some things really do need to exist exactly once; no-one
balks at putting '<div id="navigation">' in a web page (it would be confusing
to have two navigation panels).
I suppose that if you're trying to write 100% re-usable widgets then having
cross-widget dependencies is a bad idea, but that's a problem that affects
all the techniques described here (except for Daniel's publish/subscribe
approach).
It looks like boshing something into the parent namespace in the widget's
__init__ method is the simplest approach, but of course it's also the
evillest approach as it does indeed limit you to one such widget.
Anyway, I'll have a think about the various options; thanks for your input!
Ricky
More information about the Twisted-web
mailing list