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

2017-05-31 Thread Jon Dufresne
On Mon, May 15, 2017 at 10:30 AM, Tim Chase wrote: > On 2017-05-15 08:54, Tim Graham wrote: > > Does anyone know of a use case for using null bytes in > > CharField/TextField? > > Is this not what BinaryField is for? It would seem to me that > attempting to store

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

2017-05-31 Thread Jon Dufresne
Just my opinion, but I think raising an exception is more helpful to developers and will result in fewer unnoticed bugs. More generally, I know the template engine has a history of silently converting unknown variables to string_if_invalid but this is more harmful than helpful in my experience.

Re: Django db backend not FIPS compliant

2017-05-31 Thread Adam Johnson
After googling a bit I found this CPython ticket: https://bugs.python.org/issue9216 . It turns out that the block is in OpenSSL and not really python land. They didn't find a solution to it in the standard library on that ticket, but I think it should be pretty easy to monkey patch in a pure

Re: Value of tightening URLValidator/EmailValidator regular expressions?

2017-05-31 Thread Collin Anderson
Hi All, There's a PR [0] to make validation match HTML. Though there's a question about what to do with domain_whitelist. Here's the background: - Originally Django didn't allow any dotless (non-FQDN) domain names. - People wanted to use "localhost", but the SMTP spec said "Local nicknames or

migrate id field from integer to biginter (probable bug)

2017-05-31 Thread drakkan
Hi, I have two models like these: class Allarme(models.Model): class Registrazione(models.Model): allarme = models.ForeignKey(Allarme, blank=True, null=True, on_delete=models.DO_NOTHING, db_constraint=False) now I want to change id field for these models from int to

Re: Make bool(AnonymousUser) evaluate to false

2017-05-31 Thread Tobias McNulty
I second the objections; my assumption when reading the line 'if request.user:' is that it's shorthand for 'if request.user is None', which is not the case. Grepping a project's code for incorrect usage of 'request.user' is simple enough, so hopefully that will suffice. I don't recommend this

Re: Make bool(AnonymousUser) evaluate to false

2017-05-31 Thread Tim Graham
My thoughts from the ticket, "The Django test suite passes with the change but I feel like that could have some backwards compatibility concerns. Also "explicit is better than implicit"? On Wednesday, May 31, 2017 at 12:44:51 PM UTC-4, Linus Lewandowski wrote: > > I suggest adding __bool__()

Re: Make bool(AnonymousUser) evaluate to false

2017-05-31 Thread Adam Johnson
I'm afraid I'm -1 on this. We already have if request.user.is_authenticated and request.user.is_anonymous which are both more explicit and pythonic. Additionally all python classes, and thus instances of User atm, are by default truthy, so implementing this custom __bool__ introduces space for

Make bool(AnonymousUser) evaluate to false

2017-05-31 Thread linus
I suggest adding __bool__() method returning False to the AnonymousUser class. This way it'll be possible to check if the user is authenticated by simply writing "if request.user:" It's a frequent source of bugs (at least for me, but probably I'm not alone) that right now this code returns

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

2017-05-31 Thread Tim Graham
Should nonexistent template filter arguments raise an exception? Current behavior: {{ value|filter:nonexistent_template_var}} raises VariableDoesNotExist for nonexistent_template_var. I guess the proposal would be to make nonexistent_tempatle_var resolve to string_if_invalid. As for me, I

Re: Django db backend not FIPS compliant

2017-05-31 Thread Tim Graham
This usage generates a short, unique identifier for a database index name. The usage of md5 here isn't security sensitive. Changing it to some other hash could be backwards incompatible because Django would no longer know the names of indexes in existing projects. There are other usages of md5

Django db backend not FIPS compliant

2017-05-31 Thread Brandon Williams
I'm running into issues when trying to migrate my models in an environment that is running FIPS restrictions regarding MD5. Here is the stack trace: Operations to perform: > Apply all migrations: admin, auth, contenttypes, dashboard, > kombu_transport_django, sessions > Running migrations: >