On Wednesday 05 March 2003 20:04, you wrote:
> That is an interesting idea, but you would need to setup scoping rules
> to avoid confusion.
> What if I have 2 differnet servlets with the same variable "count",  Do
> they both map to the same session item or do they map to
> servletName.count()

Definatelly, scoping rules are very important.
I was thinking along the line of a "task scope": There are session variables 
that are global (within an application) like for example "user" 
and some that are only used to communicate some values from "awake" to any 
other classmethod.

>
> Another, more webwarish approach might be to setup your setters and
> getters in the session class itself, and then call
> self.session.count = 5

Well, that's probably my point. I don't want to be webwarish :-)
I want to develop a webapplication as if it were a standalone application.

>
> -Aaron
>

Stephan
> 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.
> >
> >Instead of using session data (or request data for that matter) in the
> > usual way, I'd rather have some magic involved to let me use this data as
> > normal servlet attributes.
> >Here is an example of what I mean. The "CountVisits" WebKit example looks
> >like (lots of code ommitted):
> >---------------------------------------------------------------------
> >class CountVisits(ExamplePage):
> >
> >    def writeContent(self):
> >        count = self.session().value('count', 0)+1
> >        self.session().setValue('count', count)
> >        self.writeln(count)
> >---------------------------------------------------------------------
> >
> >I'd rather like to write something like (and the uninitiated really do
> > :-): --------------------------------------------------------------------
> > class CountVisits(ExamplePage):
> >
> >    def writeContent(self):
> >        self.count  += 1
> >        self.writeln(self.count)
> >---------------------------------------------------------------------
> >
> >Do do so, one could use appropriate __getattr__ and __setattr__  methods
> > for the servlet. This full code could now look like this:
> >
> >--------------------------------------------------------------------------
> >--------------- class CountVisits(ExamplePage):
> >    _sessionData_ = {'count':0}
> >
> >    def __getattr__(self,key):
> >        if key in self._sessionData_.keys():
> >            try:
> >                return self.session().value(key)
> >            except KeyError:
> >                self.session().setValue(key,self._sessionData_[key])
> >                return self._sessionData_[key]
> >        else:
> >            raise AttributeError,key
> >
> >    def __setattr__(self,key,value):
> >        if key in self._sessionData_.keys():
> >            self.session().setValue(key,value)
> >        else:
> >            self.__dict__[key] = value
> >
> >    def writeContent(self):
> >        self.count += 1
> >        self.writeln(self.count)
> >--------------------------------------------------------------------------
> >-----------------
> >
> >The question now is the following:
> >Has anybody done something like that already?
> >What kind of features would you like to see?
> >
> >I was thinking of providing a similar technique to populate servlet
> >attributes with Request values as well.
> >
> >Thanks for your patience
> >
> >Stephan
> >
> >
> >-------------------------------------------------------
> >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
>
> -------------------------------------------------------
> 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


-------------------------------------------------------
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

Reply via email to