On Tue, Jul 22, 2008 at 3:47 PM, arun chhetri <
chhetriarun84@gmail.com> wrote:
> from twisted.web import resource, server
> from twisted.web import http
>
> class HomePage(resource.Resource):
> def __init__(self):
> resource.Resource.__init__(self)
> self.putChild('calendar',Calendar(user=None,pswd=None,server=None))
>
> def render(self,request):
> return"""<html><body>
> <a href = calendar>Here is the solution
> <body>
> </html>"""
> def getChild(self,path,request):
> return
> Calendar(request.args["user"],request.args["pswd"],request.args["server"])
>
> class Calendar(resource.Resource):
> def __init__(self,user,pswd,server):
> resource.Resource.__init__(self)
> self.user = user
> self.pswd = pswd
> self.server = server
> self.putChild('month',Month(user))
>
> def render(self,request):
> return"""<p> The user is %s
> <a href=/calendar/month> The link to the month is this
> """%self.user[0]
>
> def getChild(self,path,request):
> return Month(self.user[0])
>
> class Month(resource.Resource):
> def __init__(self,user):
> resource.Resource.__init__(self)
> self.user = user
> def render(self,request):
> return """ %s"""%self.user
>
> if __name__=="__main__":
> from twisted.internet import reactor
> root = HomePage()
> site = server.Site(root)
> reactor.listenTCP(8000,site)
> reactor.run()
>
> now if i go to
http://localhost:8000/?user=arun&pswd=test&server=test
> i get this The user is arun The link to the month is this
> and if I click the link then I get None
>
> Can anybody help me how I can redirect the value self.user to Month so that
> instead of None it shows the user name provided in query string
>
> Thanks in advance