How would I call a wildcard variable in python POST method? -
i still fresh python , trying web app return wildcard variable (as catch-all). here current code, functions correctly defined dictionary paths empty form responses, cant function undefined entries:
def post(self): form = web.input(action=none) if session.room: if form.action: session.room = session.room.go(form.action) if not form.action: web.seeother("/") return render.show_room(room=session.room) else: web.seeother("/")
here dictionary reference i'm attempting ('*' wildcard catch-all):
escape_pod.add_paths({ '2': the_end_winner, '*': the_end_loser }) the_bridge.add_paths({ 'throw bomb': bridge_death, 'slowly place bomb': escape_pod, '*': the_bridge }) laser_weapon_armory.add_paths({ '132': the_bridge, '*': laser_death }) central_corridor.add_paths({ 'shoot!': shoot_death, 'dodge!': dodge_death, 'barrel roll': poor_sport, 'tell joke': laser_weapon_armory, '*': central_corridor }) poor_sport.add_paths({ 'let me try again': central_corridor, '*': poor_sport })
i have gotten work once reason editor didnt save version in local file history? welcomed.. thank you!
here stack trace terminal. know issue, cant seem figure out how reword function call wildcard.
traceback (most recent call last): file "/users/isabey/anaconda/lib/python2.7/site- packages/web/application.py", line 239, in process return self.handle() file "/users/isabey/anaconda/lib/python2.7/site- packages/web/application.py", line 230, in handle return self._delegate(fn, self.fvars, args) file "/users/isabey/anaconda/lib/python2.7/site- packages/web/application.py", line 462, in _delegate return handle_class(cls) file "/users/isabey/anaconda/lib/python2.7/site- packages/web/application.py", line 438, in handle_class return tocall(*args) file "/users/isabey/projects/gothonweb/bin/app.py", line 48, in post return render.show_room(room=session.room) file "/users/isabey/anaconda/lib/python2.7/site- packages/web/template.py", line 1020, in template return self._base(t(*a, **kw)) file "/users/isabey/anaconda/lib/python2.7/site- packages/web/template.py", line 881, in __call__ return basetemplate.__call__(self, *a, **kw) file "/users/isabey/anaconda/lib/python2.7/site- packages/web/template.py", line 808, in __call__ return self.t(*a, **kw) file "templates/show_room.html", line 19, in __template__ $room.description attributeerror: 'nonetype' object has no attribute 'name'
Comments
Post a Comment