Re: Template handling of undefined variables

2017-02-19 Thread Adam Johnson
+1 for more obvious errors, silently changing the behaviour could indeed lead to unconsidered security holes like {% if user is None %} non-sensitive information {% else %} sensitive information {% endif %} ...which doesn't seem like an unrealistic template snippet. We all know variables can go m

Modifying django.db.models.expressions.Func.as_sql() to allow `**extra_context` to be more useful

2017-02-19 Thread melinbrad
I'm busy working on a patch to add a string index function to the default database functions: https://code.djangoproject.com/ticket/27834 As part of this patch, the arguments passed to the LOCATE MySQL function need to be in reverse order to all of the other backend implementations. I've been t

Re: Modifying django.db.models.expressions.Func.as_sql() to allow `**extra_context` to be more useful

2017-02-19 Thread Adam Johnson
I don't understand the implications of moving the extra_context line, but is it not possible to reverse the order of the params in as_mysql with something like the following? def as_mysql(self, compiler, connection): self.source_expressions = reversed(self.source_expressions) sql, params =

Re: Channels: get IP address of client websocket

2017-02-19 Thread Fabien Millerand
Got it. Sorry and thanks. Le vendredi 17 février 2017 19:22:27 UTC+1, Andrew Godwin a écrit : > > It's in the connect message, as message['client']: > http://channels.readthedocs.io/en/latest/asgi.html#connection > > Andrew > > On Fri, Feb 17, 2017 at 10:05 AM, Fabien Millerand > wrote: > >> A

Re: Channels: get IP address of client websocket

2017-02-19 Thread Fabien Millerand
Just for info, it cannot be emulated in the HttpClient for testing, unlike the regular django one where REMOTE_ADDR='IP_ADDRESS' can be passed Le dimanche 19 février 2017 20:56:29 UTC+1, Fabien Millerand a écrit : > > Got it. Sorry and thanks. > > > > Le vendredi 17 février 2017 19:22:27 UTC+1,

Re: Replacing the contrib.sites Site model with a setting?

2017-02-19 Thread Wim Feijen
Hi all, I'm in favour of defining the sites in settings. In addition, it would ease transferring db dumps from live to test servers and it would prevent db queries. I wonder, because we define sites in ALLOWED_HOSTS as well, whether we can combine these settings. For scheme, what are expecte

About secure-auth

2017-02-19 Thread acamue
How do I tell django to use --skip-secure-auth when connecting to mysql? 049, "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)") -- You received this message because you are subscribed to the Google Groups "Django developers (Contributi

Re: Modifying django.db.models.expressions.Func.as_sql() to allow `**extra_context` to be more useful

2017-02-19 Thread Josh Smeaton
Avoid modifying self in `as_` methods if possible, even if you are going to restore state. See how some of the others work around needing to switch order etc here: https://github.com/django/django/blob/75f0070a54925bc8d10b1f5a2b6a50fe3a1f7f50/django/db/models/functions/base.py#L58 Short versio

Re: About secure-auth

2017-02-19 Thread Michael Manfre
Hi, This mailing list is for the discussion of developing Django itself. Questions related to using Django are meant for the django-users mailing list. I'm not familiar enough with the MySQLdb python package, but if it supports that as a connection option, you'd need to provide it under the DATAB