Model:

db.define_table('item',
  Field('unit_price','double'),
  Field('quantity','integer'),
  Field.Virtual('total_price', lambda row: row.unit_price*row.quantity)
)

just trying to access item table via appadmin gives:

    Traceback (most recent call last):
  File "C:\w2p\web2py_2.3.2_src\applications\test\controllers/appadmin.py", 
line 227, in select
    limitby=(start, stop))
  File "C:\w2p\web2py_2.3.2_src\gluon\dal.py", line 8905, in select
    return adapter.select(self.query,fields,attributes)
  File "C:\w2p\web2py_2.3.2_src\gluon\dal.py", line 2146, in select
    return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "C:\w2p\web2py_2.3.2_src\gluon\dal.py", line 1631, in select
    return self._select_aux(sql,fields,attributes)
  File "C:\w2p\web2py_2.3.2_src\gluon\dal.py", line 1612, in _select_aux
    return processor(rows,fields,self._colnames,cacheable=cacheable)
  File "C:\w2p\web2py_2.3.2_src\gluon\dal.py", line 2010, in parse
    box[f] = v.f(row)
  File "C:\w2p\web2py_2.3.2_src\applications\test\models\item.py", line 4, in 
<lambda>
    Field.Virtual('total_price', lambda row: row.unit_price*row.quantity)
AttributeError: 'Row' object has no attribute 'unit_price'


Using sqlite. This happens even after deleting all databases.

Denes

-- 



Reply via email to