Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 'fixed pickle raw' break db.tableName usage #668

Open
jvanbraekel opened this issue Aug 6, 2021 · 2 comments
Open

The 'fixed pickle raw' break db.tableName usage #668

jvanbraekel opened this issue Aug 6, 2021 · 2 comments

Comments

@jvanbraekel
Copy link
Contributor

jvanbraekel commented Aug 6, 2021

Hello,

The 'fixed pickle raw' commit : b9277a4, break the db queries of type db(db.TableName.field == value) . While db(db.TableName.id == request.vars.id) is broken, the equivalent db.TableName(request.vars.id) is still fine trough. However there is not always an existing equivalent; for instance for select on non id fields or when the render() function is used afterwards.

Following an example of errors I get :

File "/opt/apps/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/opt/apps/web2py/applications/.../controllers/controllername.py", line 206, in
File "/opt/apps/web2py/gluon/globals.py", line 430, in
self._caller = lambda f: f()
File "/opt/apps/web2py/applications/.../controllers/default.py", line 159, in ...
current_object = db(db.TableName.id == request.vars.id).select().render(0,fields=[db.TableName.field])
File "/opt/apps/web2py/gluon/packages/dal/pydal/objects.py", line 3571, in render
row[field._tablename][field.name],
File "/opt/apps/web2py/gluon/packages/dal/pydal/objects.py", line 146, in getitem
raise KeyError(key)
KeyError: 'TableName'

The only solution I have at the moment is to roll back to the previous commit , namely : 7237a87

@jvanbraekel jvanbraekel changed the title The 'fix pickkle raw' break db.tableName usage The 'fix pickle raw' break db.tableName usage Aug 6, 2021
@jvanbraekel jvanbraekel changed the title The 'fix pickle raw' break db.tableName usage The 'fixed pickle raw' break db.tableName usage Aug 6, 2021
@leonelcamara
Copy link
Contributor

leonelcamara commented Feb 7, 2022

@mdipierro this "fix" for pickle raw is also the cause of web2py cache disk tests failing.

Other people looking at this note that simply going back to a previous commit is not ideal as there were security patches since then.

@mdipierro
Copy link
Contributor

I cannot reproduce this. I need an example. Possibly an example using pydal only, not web2py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants