webpy

globals aren't working

>>> t('$x')() Traceback (most recent call last): ... NameError: global name 'x' is not defined >>> t('$x', globals={'x': 1})() I expected: u'1\n' the actual was: Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 't' is not defined Why aren't my globals working? ...

same line behaves correctly or gives me an error message depending on file position

gives me an error message: class logger: session = web.ctx.session #this line doesn't give me an error message: class create: def GET(self): # loggedout() session = web.ctx.session #this line form = self.createform() return render.create(form) Why? ...

Using webpy's web.template.render() with a relative path when deployed on Apache

Using webpy, what's the proper way to reference the templates directory for web.template.render() so that it works on both the webpy development web server and on Apache? The following code works using the development server but not when running on my Apache server. import web urls = ( '/', 'index', ) class index: def GET(self)...

How do you form an array in a JSON object for a query string?

When sending an array in a JSON object in a query string, is each array element supposed to have the same key? For example, if I have this JSON object: {"sodas[]": ["coke", "sprite", "fanta"]} Should the query string look like this, with all the keys exactly the same (sodas%5B%5D)? sodas%5B%5D=coke&sodas%5B%5D=sprite&sodas%5B%5D=fan...

How can my desktop application be notified of a state change on a remote server?

I'm creating a desktop application that requires authorization from a remote server before performing certain actions locally. What's the best way to have my desktop application notified when the server approves the request for authorization? Authorization takes 20 seconds average on, 5 seconds minimum, with a 120 second timeout. I co...