Traceback with record versioning enabled and common_filter defined.

96 na pagtingin
Lumaktaw sa unang mensaheng hindi pa nababasa

Jose C

hindi pa nababasa,
Ene 7, 2015, 1:11:44 PM1/7/15
para kayweb...@googlegroups.com
Hello all,

I have enabled record versioning on several tables using
auth.enable_record_versioning(db)


which seems to work as expected. When I add any common_filter to a versioned table, such as the simple one below:

common_filter = lambda query: db.property_detail.is_active == True,

I get this traceback:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Traceback (most recent call last):
File "/home/jose/python-environments/web2py-trunk/web2py/gluon/restricted.py", line 224, in restricted
exec ccode in environment
File "/home/jose/python-environments/web2py-trunk/web2py/applications/propman/models/2_propman_tables.py", line 320, in <module>
auth.enable_record_versioning(db)
File "/home/jose/python-environments/web2py-trunk/web2py/gluon/tools.py", line 1716, in enable_record_versioning
current_record_label=current_record_label)
File "/home/jose/python-environments/web2py-trunk/web2py/gluon/dal/objects.py", line 431, in _enable_record_versioning
newquery = query & newquery
TypeError: unsupported operand type(s) for &: 'function' and 'function'

Can anyone else confirm this behaviour? I'll file a bug report if it is confirmed that it isn't just me.

web2py versions tested: 2.9.5, and latest trunk = Version 2.9.12-beta+timestamp.2015.01.07.05.06.34

Regards,
Jose

Jose C

hindi pa nababasa,
Ene 10, 2015, 2:58:21 AM1/10/15
para kayweb...@googlegroups.com

Niphlod

hindi pa nababasa,
Ene 10, 2015, 7:20:31 AM1/10/15
para kayweb...@googlegroups.com
uhm....but record_versioning adds a common_filter per se, and is usually on the form of is_active == True. Did you try to set a different common_filter ?

On Saturday, January 10, 2015 at 8:58:21 AM UTC+1, Jose C wrote:

Jose C

hindi pa nababasa,
Ene 10, 2015, 8:01:56 AM1/10/15
para kay
On Saturday, 10 January 2015 12:20:31 UTC, Niphlod wrote:
uhm....but record_versioning adds a common_filter per se, and is usually on the form of is_active == True. Did you try to set a different common_filter ?

Yes I tried various, within the table definition and external to it (post definition).  I used that one as the simplest example (probably not the best).  But even so, all it should do is create a query with the 2 statements (even though they are the same condition).  Something like (WHERE fld == True AND fld == True).  Redundant, sure... but shouldn't cause a traceback. 

I looked into the code where it happens and that line is trying to `&` two lambda functions (hence the traceback error message).  From my understanding it should be trying to `&` two query objects, not functions.  I did try converting  to queries, applying the & operator and then converting back to function, but that broke something else down line in record versioning for reasons I haven't figured out yet.  So no solution yet.

Will post to the bug report if I get it to work.

Paolo Valleri

hindi pa nababasa,
Ene 10, 2015, 8:15:48 AM1/10/15
para kay
Hi, 
I've fixed the error but I've to understand if all common_filters are applied correctly. 

Jose C

hindi pa nababasa,
Ene 10, 2015, 8:31:44 AM1/10/15
para kayweb...@googlegroups.com
On Saturday, 10 January 2015 13:15:48 UTC, Paolo Valleri wrote:
Hi, 
I've fixed the error but I've to understand if all common_filters are applied correctly. 

Ok, will add some more common filters and get onto testing it asap.

Jose C

hindi pa nababasa,
Ene 10, 2015, 11:31:20 AM1/10/15
para kayweb...@googlegroups.com

Ok Paolo, it all appears to work as expected now with trunk (2.9.12 beta) -  at least with my current system and setup.  I also backported your change to my dev version (2.9.5) and it too works.

Many thanks for fixing this bug so quickly.

Paolo Valleri

hindi pa nababasa,
Ene 10, 2015, 12:13:44 PM1/10/15
para kayweb...@googlegroups.com

 Paolo

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/mohm6Nb8Mfc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tumugon sa lahat
Sumagot sa may-akda
Ipasa
0 bagong mensahe