Hi,
I'm using web2py DAL for a legacy database which has a Table users with a field named "pass".
I've used the "rname" to alias the "pass" field.
unfortunately doesn't work.
db.define_table('users',
Field('uid', 'integer'),
Field('name','string'),
Field('pass', rname='passwd'),
Field('mail','string'),
Field('theme','string'),
Field('signature','string'),
Field('signature_format','string'),
Field('created','integer'),
Field('access','integer'),
Field('login','integer'),
Field('status','integer'),
Field('timezone','string'),
Field('language','string'),
Field('picture','integer'),
Field('init','string'),
Field('data','blob'),
primarykey=['uid'],
migrate=False)
Traceback (most recent call last):
File "/home/sas/PycharmProjects/pydal/index.py", line 8, in <module>
Field('pass', rname='passwd'),
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/objects.py", line 1438, in __init__
'use rname for "funny" names' % fieldname)
SyntaxError: Field: invalid field name: pass, use rname for "funny" names
Another question; I do I define with(define_table) only some field of the DB-Table.
Because commenting out the "pass" field it throws many errors which I do not completely understand:
Traceback (most recent call last):
File "/home/sas/PycharmProjects/pydal/index.py", line 41, in <module>
users = db().select(db.users.ALL)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/objects.py", line 2020, in select
return adapter.select(self.query, fields, attributes)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1296, in select
return self._select_aux(sql,fields,attributes)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1277, in _select_aux
return processor(rows,fields,self._colnames,cacheable=cacheable)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1767, in parse
for row in rows]
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1677, in _parse
value = self.parse_value(value, ft, blob_decode)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1527, in parse_value
return self.parsemap[key](value,field_type)
File "/home/sas/virtualpy/local/lib/python2.7/site-packages/pydal/adapters/base.py", line 1592, in parse_blob
return base64.b64decode(str(value))
File "/usr/lib/python2.7/base64.py", line 76, in b64decode
raise TypeError(msg)
TypeError: Incorrect padding
Thks.
Xaver