On 10 Jan 2013, at 10:34 AM, Kic <lis...@lavalite.de> wrote: > Dear community, > > I have a strange problem reading in request.args . > I was trying to implement the mechanism from the web2py book, chapter 29, > SQLFORM.grid where it says: > > def manage(): > table = request.args(0) > if not table in db.tables(): redirect(URL('error')) > grid = SQLFORM.grid(db[table],args=request.args[:1]) > return locals() > > and put that into controller remote. > > I am always getting an error: > > TypeError: 'in <string>' requires string as left operand, not NoneType
You have a double puzzle here. Not only should table not be None (apparently), but db.tables() should be a list, not a string. > > in the line > > if not table in db.tables(): redirect(URL('error')) > > because table was not assigned a value because request.args is always empty. > > My URL looks like this: > > https://hostname:3001/remote/manage/myarg > > so I would expect table to get the value 'myarg'. > > When I look into the full request, args is definitely empty. I only have > slashes and letters in my URL after the port number, no spaces, special > characters, nothing. Can anyone please help me and let me know what I am > doing wrong? I downloaded the stable version today, so it should all be in > order. > > I have the following in routes.py to remove the app name: > > routers = dict( > BASE=dict( > default_application='myapp', > root_static='favicon.ico' > ), > ) > logging = 'debug' > > Thanks a lot and cheers, > --