I have the following code that does a simple hello wolrd app using
webpy. For each call to the GET method, the class Dashboards
"__init__" method gets called. Is there a way to change the behavior
to let __init__ be called only once? I have some expensive setup
methods in __init__ and I don't want them getting called for each call
to GET.

import web
urls = ('/', 'Dashboard')
web.config.debug = False
app = web.application(urls, globals())
class Dashboard:
    def __init__(self):
        # Add other init methods here
        print "Should be printed only once"

    def GET(self):
        return "Hello world!"

if __name__ == "__main__":
    app.run()

I am sure there is something rudimentary that I am missing. Hope
someone here can help me. I tried searching on the groups and on the
webpy site for info. But no luck still.

-T

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to