def horizontal_radios(f,v):
table = SQLFORM.widgets.radio.widget(f,v)
rows = table.elements('tr')
table.components = []
table.append([row.elements('td') for row in rows])
return table What is the expected output? What do you see instead? I expect that the inclusion of widget=SQLFORM.widgets.text.widget in the FIELD definition of comment would set the GAE multi-line property to true.
Instead, this doesn't get set, and it barfs with:
Traceback (most recent call last):
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/restricted.py", line 188, in restricted
exec ccode in environment
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/applications/rubrics/controllers/default.py:commitRubric", line 183, in
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/globals.py", line 95, in
self._caller = lambda f: f()
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/applications/rubrics/controllers/default.py:commitRubric", line 75, in commitRubric
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/dal.py", line 3875, in insert
return self._db._adapter.insert(self,self._listify(fields))
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/dal.py", line 2729, in insert
tmp = table._tableobj(dfields)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init.py", line 812, in init
prop.set(self, value)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init.py", line 541, in set
value = self.validate(value)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init**.py", line 2435, in validate
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property comment is not multi-line
If I replace
comment = request.vars.comment,
with
comment = request.vars.comment.replace("\n","\n",
during the commit step, it will work. This isn't really ideal though. What version of the product are you using? On what operating system? web2py 1.91.6
google_appengine 1.4.1
Ubuntu 10.04 LTS Please provide any additional information below.
From nathan...@gmail.com on January 29, 2011 12:01:48
What steps will reproduce the problem? 1. Build an SQLFORM.Factory with a widget=SQLFORM.widgets.text.widget)
Display the form and on form.accepts(request.vars) send to a different part of the app:
if form.accepts(request.vars):
def commitRubric(): db.allRatings.insert( timeend = request.now.strftime('%Y-%m-%d %H:%M:%S'), timestart = request.vars.timestart, assignmentId = request.vars.assignmentId, experimentId = request.vars.experimentId, workerId = request.vars.workerId, studentIds = request.vars.studentIds, rubricCode = request.vars.rubricCode, ipaddress = request.client, comment = request.vars.comment, rawAnswers = request.vars.rawAnswers, subscores = request.vars.subscores, )
The model definition is:
db.define_table('allRatings', Field('timeend','datetime',requires= IS_NOT_EMPTY() ), Field('timestart','datetime',requires= IS_NOT_EMPTY() ), Field('assignmentId',requires= IS_NOT_EMPTY() ), Field('experimentId',requires= IS_NOT_EMPTY() ), Field('workerId',requires= IS_NOT_EMPTY() ), Field('studentIds',requires= IS_NOT_EMPTY() ), Field('rubricCode',requires= IS_NOT_EMPTY() ), Field('ipaddress' ,default=request.client), Field('comment',widget=SQLFORM.widgets.text.widget), Field('rawAnswers',requires= IS_NOT_EMPTY() ), Field('subscores',requires= IS_NOT_EMPTY() ) )
Need this for some of the rubric options.
def horizontal_radios(f,v): table = SQLFORM.widgets.radio.widget(f,v) rows = table.elements('tr') table.components = [] table.append([row.elements('td') for row in rows]) return table What is the expected output? What do you see instead? I expect that the inclusion of widget=SQLFORM.widgets.text.widget in the FIELD definition of comment would set the GAE multi-line property to true.
Instead, this doesn't get set, and it barfs with: Traceback (most recent call last): File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/applications/rubrics/controllers/default.py:commitRubric", line 183, in
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/globals.py", line 95, in
self._caller = lambda f: f()
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/applications/rubrics/controllers/default.py:commitRubric", line 75, in commitRubric
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/dal.py", line 3875, in insert
return self._db._adapter.insert(self,self._listify(fields))
File "/home/vanhoudn/Dropbox/workspace-linux/creatia-rubrics/src/gluon/dal.py", line 2729, in insert
tmp = table._tableobj(dfields)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init.py", line 812, in init
prop.set(self, value)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init.py", line 541, in set
value = self.validate(value)
File "/home/vanhoudn/google_appengine.1.4.1/google/appengine/ext/db/init**.py", line 2435, in validate
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property comment is not multi-line
If I replace comment = request.vars.comment, with comment = request.vars.comment.replace("\n","\n", during the commit step, it will work. This isn't really ideal though. What version of the product are you using? On what operating system? web2py 1.91.6 google_appengine 1.4.1 Ubuntu 10.04 LTS Please provide any additional information below.
Original issue: http://code.google.com/p/web2py/issues/detail?id=169