On Mon, 18 Aug 2008 10:15:46 -0500, arun chhetri <[EMAIL PROTECTED]> wrote:
So, does this means that twisted.web can only handle one request at a
time,,,,, why It should do that.
[snip]

class Optional(resource.Resource):
[snip]
    def render(self,request):
[snip]
                    self.account['value'] = CalendarSource
                    self.index = 1
        request.redirect("/optional/Calendar")
        return " "

[snip]

if __name__ == "__main__":
    from twisted.internet import reactor
    root = resource.Resource()
    root.putChild('',HomePage())
    root.putChild('optional',Optional())
    site = server.Site(root)
    reactor.listenTCP(8000,site)
    reactor.run()

There is just one instance of `Optional´ in your application.  That
instance will be used to render the response to any request for
`/optional´.  The `Optional´ class also keeps state on itself which
appears to be associated with different users.  So whenever multiple
users make requests of your server, that single `Optional´ instance
is going to mix state from them together.  What you probably want to
do instead is have many instances of `Optional´, perhaps one per user
of your system.  This means keeping track of them somewhere and finding
the right one to use for any particular request.  For example, you might
keep a dict keyed on username somewhere and in a custom `getChild´
implementation find the right one and return it.

Jean-Paul

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to