On Wed, 2003-03-05 at 12:17, Stephan Diehl wrote:
> Hi all,
> I'm developing with Webware for quite a while and I still think that working
> with applets is not as intuitive as it might be. This has in principle
> nothing to do with Webware but with Web development in general.
> Now, using Python, gives us a lot of tools that can be used for our advantage.
Whoops, I read "applets" and then ignored the thread, thinking it was
another client-side Java thread, but I think you meant "servlet".
> class CountVisits(ExamplePage):
>
> def writeContent(self):
> self.count += 1
> self.writeln(self.count)
I would entirely support -- and proposed at one time -- that you should
be able to do
self.session.count += 1
though I do wonder if it wouldn't be as pretty when you'd be forced to
do
self.session.count = getattr(self.session, 'count', 0) + 1
because sessions are being created all the time, so you usually have to
expect that they may be empty. You'd almost need something like an
__init__ for the session objects (an __init__ that was for your
particular application, of course, not Webware's Session.__init__). But
that __init__ would be application-wide, but individual servlets might
have specific expectations, and putting all those expectations into one
session initialization would be annoying. So maybe it would be useful
only if it was developed further.
I've also thought about it for requests, though it becomes awkward as
well when you don't want to depend on all the variables being present.
Now the idea top in my mind is expansion, like:
def someAction(self, var1, var2_int, var3="something"):
...
So that var1 and var2 would be required variables, and var2 would be
turned into an int. I hate Zope's method of using an HTML variable name
of var2:int, and I'd rather see the HTML have var2, and the function
definition have the type declaration in it.
But that just works for request variables, the analog wouldn't work for
sessions.
Making the session the implicit storage for all servlet instance
variables doesn't seem like a good idea. I don't like implicit stuff
like that at all. The burden of typing "self.session" instead of just
"self" is not great enough to justify introducing that sort of magic
behavior.
Ian
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss