Deprecating AuthenticationMiddleware

2017-06-02 Thread Tim Graham
Curtis started a PR [0] that replaces the functionality of AuthenticationMiddleware.process_request(): request.user = SimpleLazyObject(lambda: get_user(request)) with this line in AuthConfig.ready(): HttpRequest.user = cached_property(get_user, 'user') Before finishing the patch, I'd like to g

Re: Value of tightening URLValidator/EmailValidator regular expressions?

2017-06-02 Thread Tim Graham
Aymeric, did anything specific change your mind from your March 2016 mail: "Indeed, for some reason, the URL and email validators get anywhere from 2 to 8 changes in every Django version, and there’s no end in sight. (I contributed to this. Sorry.) Like James, I’m in favor of making the validat

Re: On ASGI...

2017-06-02 Thread Tom Christie
> I suspect there is potential for a very fast async-only layer that can trigger the await that's hanging in a receive_async() directly from a send() to a related channel, rather than sticking it onto a memory location and waiting Yup. Something that the gunicorn worker doesn't currently provid

Re: Incorrect escaping in Django SQL query

2017-06-02 Thread Tim Graham
I couldn't find any testing of TruncDay with Value(). Is there a difference between the query you're trying to construct and MyModel.objects.filter(created__lt=timezone.now().date()) ? On Thursday, June 1, 2017 at 7:35:25 AM UTC-4, Roshan Raghupathy wrote: > > Hi, > > I came across an issue yest

Re: should nonexistent template filter arguments resolve to string_if_invalid rather than raise VariableDoesNotExist?

2017-06-02 Thread Vlastimil Zíma
Django now reports invalid variable names by 'VariableDoesNotExist' exception, which is logged. So it is possible to track down invalid variable names. The problem I see here is inconsistency in handling invalid variable names. If invalid variable is rendered or used in an 'if' tag, it is silen

Re: migrate id field from integer to biginter (probable bug)

2017-06-02 Thread Tim Graham
Yes, it looks like a bug. The incorrect SQL is added here: https://github.com/django/django/blob/8149bd00d8b8af816a683e5ecc0e204f344616f5/django/db/backends/base/schema.py#L745-L749 On Wednesday, May 31, 2017 at 1:34:07 PM UTC-4, drakkan wrote: > > Hi, > > I have two models like these: > > class

Re: Tabs in Django Admin forms?

2017-06-02 Thread Tim Graham
I think Django can't reasonably add every feature under the sun to the admin. If you need a pixel perfect UI, use your own views. On Tuesday, May 30, 2017 at 4:50:16 AM UTC-4, Óscar M. Lage wrote: > > Oh, sorry, something like this: > > >

Re: Tests failing on postgres 9.6

2017-06-02 Thread Tim Graham
Closing the loop for anyone who finds this message and doesn't click through to the ticket: It seems to be a locale problem. Cleaned up everything (removed /usr/local/var/postgres), installed postgres again with export LC_ALL=en_US.UTF-8; export LANG=en_US.UTF-8 and it worked. On Tuesday, May

Re: Are there use cases for storing null bytes in CharField/TextField?

2017-06-02 Thread Tim Graham
I found a PostgreSQL bug report requesting removal of the restriction. Here's the final reply: Franklin Schmidt wrote: > I agree that storing 0x00 in a UTF8 string is weird, but I am > converting a huge database to postgres, and in a huge database, weird > things happen. Using bytea for a text f

Re: Incorrect escaping in Django SQL query

2017-06-02 Thread Tim Graham
Cross posted to django-users: https://groups.google.com/d/msg/django-users/nNgcv2QajCI/hPRwIeVNBAAJ In the future, please keep the conversation in one place. django-users is fine for asking "is it a bug?" questions. On Friday, June 2, 2017 at 11:26:22 AM UTC-4, Tim Graham wrote: > > I couldn't

Re: Tabs in Django Admin forms?

2017-06-02 Thread Adam Johnson
I agree, it sounds like feature creep to me. It could probably be provided by code in a third party package too, the admin is very extensible. On 2 June 2017 at 16:42, Tim Graham wrote: > I think Django can't reasonably add every feature under the sun to the > admin. If you need a pixel perfect

Re: On ASGI...

2017-06-02 Thread Andrew Godwin
Right. I'll try and get a full async example up in channels-examples soon to show off how this might work; I did introduce a Worker class into the asgiref package last week as well, and the two things that you need to override on that are "the list of channels to listen to" and "handle this message

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

2017-06-02 Thread Zack Voase
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 be checked (to make sure we're not querying/setting a property

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. I'

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 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, > > I'm encoun

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 be