Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-04 Thread Adam Johnson
I've made a pair of PR's, one for Django master and one for the 1.11 branch. On master, which is Python 3+, getattr_static is used . https://github.com/django/django/pull/8599 https://github.com/django/django/pull/8601 On 3 June 2017 at 01:02, Carl Meyer wrote: > Hi Zack, >

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-02 Thread Carl Meyer
Hi Zack, On 06/02/2017 02:02 PM, Zack Voase wrote: > Hi all, > > I'm encountering exceptions in a number of popular third-party Django > libraries when upgrading from 1.8 to 1.11. The code path is typically > `MyModel.objects.get_or_create(...)`, which causes > `model._meta._property_names` to

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-02 Thread Sergey Fursov
Hi everyone, I just want to mention here that in django-jsonfield repo proposed solution to solve this problem on third party side: https://github.com/dmkoch/django-jsonfield/issues/189. Maybe this is the better way. Thanks, Sergey 2017-06-03 0:02 GMT+03:00 Zack Voase : > Hi all,

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-02 Thread Curtis Maloney
What about using inspect.getmembers ? https://docs.python.org/3/library/inspect.html#inspect.getmembers In other code I've also used inspect.classify_class_attrs but it seems to be undocumented :/ If nothing else, it could be used as a guide on how to do this. -- Curtis On 03/06/17 08:52,

Re: Exceptions in model._meta._property_names with some 3rd-pty libraries

2017-06-02 Thread Adam Johnson
This is my bad, I did the refactoring :) You're right, the original version did in fact use a try..except AttributeError and that should be preserved for cases like this.