dropdown control don't work's fine with table records in Google App Engine
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
web.py |
New
|
Undecided
|
Unassigned |
Bug Description
To reproduce the error, follow a example code:
# in the forms.py
result = data.all_
args = [(row.key().id(), row.title) for row in result]
new_post = form.Form(
form.
form.
form.
form.
form.
# in code.py
class Post:
def GET(self):
frm = forms.new_post()
return render.
def POST(self):
global last_updated
frm = forms.new_post()
if frm.validates(): # in this point the error occurs.
raise web.seeother('/')
else:
return render.
IMHO the root cause of the problem is the 'big table' format, I say this because the form generated by the GET method is correct(It has the <option value="1">Category A</option>, <option value="2">Category B</option>) but when I submit the form and the forms.validates() is called the error occurs.
The problem occurs in the forms.py in this function:
def attrget(obj, attr, value=None):
if hasattr(obj, 'has_key') and obj.has_key(attr): return obj[attr]
if hasattr(obj, attr): return getattr(obj, attr)
return value
generate this error:
<type 'exceptions.
args = ("'unicode' object has no attribute 'has_key'",)
message = "'unicode' object has no attribute 'has_key'"
I don't know if this is the best approach, but I have a solution to this problem in this thread: groups. google. com/group/ webpy/browse_ thread/ thread/ 484cb3fadac5de3 2/94634856c335d 001#94634856c33 5d001
http://