Additional argument in method GET

I would like to pass an additional argument in handling method GET in Python.

class Lista:
def GET(self):
    try:
        request = Request("")
        response_body = urlopen(request).read()
        decoded = json.loads(response_body)
        return render.list(content = decoded, user = decoded[0])
    except(ValueError, KeyError, TypeError):
        print "JSON format error"

class Mail:
    def GET(self):
    request = Request("")
    response_body = urlopen(request).read()
    decoded = json.loads(response_body)
    return render.mail(content = decoded, omail = decoded[0])

In class Lista downloading a list of objects from the Request URL and I render the HTML file "list". On the rendered page, I have a choice of several users. I would like to pass to the next class is what the user chose(by clicking).

Please help!

Answers


I think you need something like unless I misunderstood:

class Lista:
    def GET(self,x=None):
        print x
        try:
            request = Request("")
            response_body = urlopen(request).read()
            decoded = json.loads(response_body)
            return render.list(content = decoded, user = decoded[0])
        except(ValueError, KeyError, TypeError):
            print "JSON format error"

Now it accepts a optional variable x, variable x is initialized to None just in case to need to send a empty request or so


Need Your Help

One iPhone searching for many iBeacons

ios iphone xcode bluetooth-lowenergy ibeacon

I'm learning iBeacon programming right now. Is it possible for an iPhone to search for any iBeacons in the area and get their UUIDs?

CSS3 background-position issue with Safari only

css css3 layout safari background-position

The following code renders well in IE9, FireFox, Chrome, but not in Safari:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.