I'm wondering if this is expected behavior or not with CRUD. Given two
tables:

db.define_table('hash_types',
    Field('htype', 'string', requires=IS_NOT_EMPTY()),
    format='%(htype)s',
)

db.define_table('hashes',
    Field('enchash', required=True, unique=True, label="Encrypted
hash"),
    Field('htype', 'reference hash_types', label="Hash type", ),
)

And a CRUD read controller:

def read():
    return dict(hashes=crud.read(db.hashes, request.args(0)))

If I perform a regular request (http://server:8000/app/default/read/1)
then the db.hashes.htype returns the string.

If I request read.json version (http://server:8000/app/default/
read.json/1) then htype return the id number, not the string/format:

{"hashes": {"enchash": "string", "htype": 1, "id": 1}}

Is that to be expected?

Reply via email to