Olivier Migeon wrote:

To the best of my knowledge (correct me if I'm wrong), you can't rely on instances variables to store persistent-accross-requests variables : the instance may or may be not reused, may or not be cached.
true.


I though that storing the result of my query in a class variable would solve the problem, but it doesn't.
My code looks like this:
(...)

So, my questions are :

1) why doesn't it work ? It's not a caching issue because my CacheServletClasses is set to 0 in my Application.config file.
i may be wrong but this setting means that at *every* page
request your MyPage class will be recreated from scratch.


2) what is the best way to make persistent variables accross requests and sessions ?

i use to compile-once cheetah templates and store them in a dictionary stored in SitePage class var, like you do your code. see below:

class SitePage(Page):

    # master page template
    HTML = 'site.html'

    # ... other code ...

    _cache = {} # master page template objects

    def writeHTML(self):

        if self.HTML in SitePage._cache:
            t = SitePage._cache[self.HTML]
        else:
            app = self.application()
            path = app.serverSidePath('www/t/%s' % self.HTML)

            # if file changes reload app
            modloader.watchFile(path)
            t = Template(file=path, filter=Latin1Encoder)

            SitePage._cache[self.HTML] = t

        # access to self with $s in template
        t.s = self
        self.write(str(t))


but CacheServletClasses must be set to 1 if I want that webware caches servlet classes, hence page templates.


cheers, deelan.


------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to