> 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('passwd', rname='pass')

 

>
>     Field('data','blob'),
>     primarykey=['uid'],
>     migrate=False)
>
>
>   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
>

The DAL base64 encodes/decodes blob fields, but presumably the blob data 
stored in your legacy database is not base64 encoded. As an alternative, 
you could define a custom field type that doesn't do the encoding/decoding:

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Custom-Field-types--experimental-

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to