[Zope-dev] Publisher and callable objects
cpita
cpita@uol.com.ar
Tue, 7 Mar 2000 16:45:32 -0300
Hi, I'm a very new Zope-Python programmer but I have
been reading many tutorials,
references and howtos since last month.
Last night I was spying the DocumentTemplate package,
and in the String module
I found some code that was intended to make the DT
appear as a function to the
Publisher. I can't exactly remember, but the idea was
to add a func_code attribute
with no bytecode and requesting the 2 arguments REQUEST
and self.
So, implementing the special __call__ method, Publisher
calls the DT as
it would call a function expecting those arguments. I
get the idea, but what I can't see is:
Is this clean? I mean, if the Publisher is assuming
that the DT is really a function
it could try to access other functionality function
objects have. Is it stated somewhere
that Publisher (once it knows that it's working with a
callable object) only uses the func_code
attributed and the subattributes that DT sets? Or that
Publisher will not depend on the type
of the callable object being FunctionType, MethodType,
etc?.
Thank you,
Carlos
_________________________________________________________________
UOLMAIL - Todo Argentino tiene derecho a tener su e-mail.
http://www.uolmail.com.ar