So the same code above is now throwing an error and when I even visit
http://127.0.0.1:8000/PROD/default/index. I know I don't feel right using
request variable in my model file so I changed
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Traceback (most recent call last):
File "C:\web2py_src_2.2.1\web2py\gluon\restricted.py", line 212, in restricted
exec ccode in environment
File "C:/web2py_src_2.2.1/web2py/applications/PROD/models/db_wizard.py"
<http://127.0.0.1:8000/admin/default/edit/PROD/models/db_wizard.py>, line 105,
in <module>
db.loadpull.points.requires=loadpull_points_in_range(request.vars.pstop,
request.vars.pstart)
File "C:/web2py_src_2.2.1/web2py/applications/PROD/models/db_wizard.py"
<http://127.0.0.1:8000/admin/default/edit/PROD/models/db_wizard.py>, line 59,
in loadpull_points_in_range
(int(Decimal(pstop)-Decimal(pstart))*10000),
File "C:\Python27\lib\decimal.py", line 658, in __new__
raise TypeError("Cannot convert %r to Decimal" % value)
TypeError: Cannot convert None to Decimal
I don't feel right about using the request variable anyway so I changed
this line:
db.loadpull.points.requires=lambda row: loadpull_points_in_range(row.pstop,
row.pstart)
And get <type 'exceptions.AttributeError'> 'str' object has no attribute
'pstop'
File "C:\web2py_src_2.2.1\web2py\gluon\html.py", line 1743, in _validate
(value, errors) = validator(value)
File "C:/web2py_src_2.2.1/web2py/applications/PROD/models/db_wizard.py"
<http://127.0.0.1:8000/admin/default/edit/PROD/models/db_wizard.py>, line 105,
in <lambda>
db.loadpull.points.requires=lambda row: loadpull_points_in_range(row.pstop,
row.pstart)
AttributeError: 'str' object has no attribute 'pstop'
db.loadpull.points.requires=lambda row: loadpull_points_in_range(
'%(row.pstop)s', '%(row.pstart)')
Is not right either
<class 'decimal.InvalidOperation'> Invalid literal for Decimal:
'%(row.pstop)s'
I really don't know what happened when my original code worked (math error
aside) when request.vars but now it won't even run.
I have been reading up on lambda functions too since I went through another
round of not having the correct number of arguments.
--