Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2023-07-03 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 Replying to [comment:47 David]:
 > Are they going to stay there or is it ok to remove them?

 We want to keep them, please check the entire discussion.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701891d1247c0-8aefb95b-61a3-4a25-8ead-5a97e029179b-00%40eu-central-1.amazonses.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2023-07-03 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by David):

 There are still many `assert` statements in the codebase
 
https://github.com/search?q=repo%3Adjango%2Fdjango+language%3APython+path%3A%2F%5Edjango%5C%2F%2F++content%3A%22+assert+%22&type=code

 Are they going to stay there or is it ok to remove them?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701891c8c5e0d-e2cba96d-5a4e-4ce6-a434-b2bc76bd92d4-00%40eu-central-1.amazonses.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-09-15 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Adam Johnson):

 Thanks all!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.98be8c03a75cb88e61aa6d55d31dc9e5%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-09-06 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * has_patch:  1 => 0
 * resolution:   => fixed


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.7b3ee2a4a4d33ac79a90e5f0a60250ff%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-09-06 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"a7f27fca5239ff3840735dc6dc731b71a99a1d57" a7f27fca]:
 {{{
 #!CommitTicketReference repository=""
 revision="a7f27fca5239ff3840735dc6dc731b71a99a1d57"
 Refs #32508 -- Raised TypeError/ValueError instead of using "assert" in
 encode() methods of remaining password hashers.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.add49733afb2d2ee4b236e0f8486822f%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-09-05 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jacob Walls):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.00a3098597bc6810c3daf0ab4c7e6944%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-09-05 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mateo Radman):

 Replying to [comment:40 Mariusz Felisiak]:
 > `assert`s in the following methods should be changed:
 > - `UnsaltedSHA1PasswordHasher.encode()`,
 > - `UnsaltedMD5PasswordHasher.encode()`,
 > - `CryptPasswordHasher.encode()`,
 > new tests are also required.

 [https://github.com/django/django/pull/14836 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.925814e7b6123b2ed0d65739c5c4edd4%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-08-31 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Mateo
 Type:   |  Radman
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mateo Radman):

 * owner:  (none) => Mateo Radman
 * status:  new => assigned


Comment:

 Replying to [comment:40 Mariusz Felisiak]:
 > `assert`s in the following methods should be changed:
 > - `UnsaltedSHA1PasswordHasher.encode()`,
 > - `UnsaltedMD5PasswordHasher.encode()`,
 > - `CryptPasswordHasher.encode()`,
 > new tests are also required.

 I'll do it!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.34c25f3a169b4628f6f92577ee1ec641%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-22 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  (none)
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * status:  assigned => new


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a1cfa05aff91ce71719702b9f87244a3%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-22 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  (none)
 Type:  Cleanup/optimization  |   Status:  assigned
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * owner:  Daniyal Abbasi => (none)
 * status:  new => assigned
 * has_patch:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.e5fda639bd90a8eec1013a7fc689ee3f%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-22 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  new
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by GitHub ):

 In [changeset:"83022d279c585be2c4173b36a92d4399e738150e" 83022d2]:
 {{{
 #!CommitTicketReference repository=""
 revision="83022d279c585be2c4173b36a92d4399e738150e"
 Refs #32508 -- Raised TypeError/ValueError instead of using "assert" in
 encode() methods of some password hashers.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.27a6c9ce3c812361bbabe6c1566000cf%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-21 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  new
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 OK, let's change asserts in `encode()` methods.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.6ec3b1ab8af90e629ebb6f82c6c08bf9%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-21 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Paolo Melchiorre):

 * cc: Paolo Melchiorre (added)


Comment:

 I agree with Chris, and I think we can reopen this issue.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f71202ef412ee1a1e0a4793c188c4baa%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-21 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Chris Jerdonek):

 I'd like to suggest that the asserts in `hashers.py` (listed above) also
 be considered. While reviewing
 [https://github.com/django/django/pull/13799 PR #13799], I noticed there
 are cases where user code can encounter them.

 For example, here are a couple of the asserts, in the case of
 `PBKDF2PasswordHasher.encode()`:
 
https://github.com/django/django/blob/012f38f9594b35743e9ab231757b7b62db638323/django/contrib/auth/hashers.py#L271-L273
 And here is an example in the Django docs instructing users to call this
 method with their own code:
 https://docs.djangoproject.com/en/3.2/topics/auth/passwords/#password-
 upgrading-without-requiring-a-login
 That section also tells the user they "can modify the pattern to work with
 any algorithm or with a custom user model." Since Django has examples
 telling users to call this method with their own code, and also since this
 is a security-related code path, I think it would be worth switching from
 `assert` statements to more explicit argument checking.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f35431cc39e0389a9143520ef724ad6f%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-15 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  closed
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * status:  assigned => closed
 * needs_better_patch:  1 => 0
 * resolution:   => fixed


Comment:

 IMO, the other `assert`s are fine.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a50c862484e0fe76e9b5eda4126faa68%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-15 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"f479df7f8d03ab767bb5e5d655243191087d6432" f479df7]:
 {{{
 #!CommitTicketReference repository=""
 revision="f479df7f8d03ab767bb5e5d655243191087d6432"
 Refs #32508 -- Raised Type/ValueError instead of using "assert" in
 django.db.models.

 Co-authored-by: Mariusz Felisiak 
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.e04a5fb288653903f5e46535d45727ef%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-05 Thread Django
#32508: Raise proper exceptions instead of using "assert".
-+-
 Reporter:  Adam Johnson |Owner:  Daniyal
 Type:   |  Abbasi
  Cleanup/optimization   |   Status:  assigned
Component:  Core (Other) |  Version:  dev
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jacob Walls):

 * owner:  nobody => Daniyal Abbasi
 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * status:  new => assigned


Comment:

 Once [https://github.com/django/django/pull/14173 Daniyal's patch] lands
 for `django.db.models` I think this will be resolved.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.dc8dbb9cf737ecacab0609992df1f8a4%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-05 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"2231429991ee17987e3897238f9e5551c5c7ab2e" 22314299]:
 {{{
 #!CommitTicketReference repository=""
 revision="2231429991ee17987e3897238f9e5551c5c7ab2e"
 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using
 "assert".
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1b0f6f4d9f685c86ed041037f5201963%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-07-02 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mateo Radman):

 Replying to [comment:29 Mateo Radman]:
 > Thank you very much and apologies for my gendered greeting.
 > I’ll start working on replacing these two asserts.

 [https://github.com/django/django/pull/14586 PR]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.71096ee5b3ebd364189fe6043cc4018f%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-27 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mateo Radman):

 Thank you very much and apologies for my gendered greeting.
 I’ll start working on replacing these two asserts.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.9dd6c109accbce35855055c41691dd5b%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-27 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak):

 Replying to [comment:27 Mateo Radman]:
 > Hey guys, what is left to be done for this ticket?
 > Thanks.

 IMO, we have only two cases that could be updated (outside of
 `django.db.models`):
 - `django/db/backends/postgresql/creation.py` - `assert
 test_settings['COLLATION'] is None`
 - `django/test/testcases.py` - `assert not self.reset_sequences,
 'reset_sequences cannot be used on TestCase instances'`

 P.S. Note that we're not all "guys" so please use gender neutral
 greetings, https://heyguys.cc/

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.735e2955baeedabcfa2dc67e946cd470%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-27 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mateo Radman):

 Hey guys, what is left to be done for this ticket?
 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1f9816f5d1bf51dec4b7f43d70fb54d7%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-24 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"8a7ac78b706797a03d26b88eddb9d1067ed35b66" 8a7ac78b]:
 {{{
 #!CommitTicketReference repository=""
 revision="8a7ac78b706797a03d26b88eddb9d1067ed35b66"
 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using
 "assert" in various code.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.ed8454e26bc2e72c98bb69615f3f46e3%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-20 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mateo Radman):

 Replaced assert keywords by raising proper exception with a descriptive
 message included.
 [https://github.com/django/django/pull/14545 PR]
 Files changed:
 - views/decorators/debug.py
 - dispatch/dispatcher.py
 - http/multipartparser.py
 - utils/regex_helper.py
 - contrib/staticfiles/storage.py
 - contrib/auth/views.py

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5da0e90c801a50b928d836ba8ff96643%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-15 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Bal Krishna Jha):

 Replying to [comment:22 Nishant Sagar]:
 > May I take this ticket and if yes can anyone suggests me the ways to
 proceed as I'm fairly new to this

 If you're still working on it, please let me know the progress and
 component you've chosen. So that I can choose other component or leave
 this ticket.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.282e5dd6a2742a5eb00667c6dd29e512%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-02 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Jacob Walls):

 Replying to [comment:22 Nishant Sagar]:
 > May I take this ticket and if yes can anyone suggests me the ways to
 proceed as I'm fairly new to this

 Thanks for your interest. Daniyal handled the bulk of what was left here
 in [https://github.com/django/django/pull/14173 PR 14173], so if you want
 to tackle the rest, be sure to skip the django.db module, which was the
 focus of that PR.

 Toward getting started, this is a great time to learn about grep, e.g.
 `grep 'assert\s' django/* -r`. Here's what's left excluding django.db and
 the test suite itself:

 {{{
 django/contrib/auth/hashers.py:assert password is not None
 django/contrib/auth/hashers.py:assert salt and '$' not in salt
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert password is not None
 django/contrib/auth/hashers.py:assert salt and '$' not in salt
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert password is not None
 django/contrib/auth/hashers.py:assert salt and '$' not in salt
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/hashers.py:assert salt == ''
 django/contrib/auth/hashers.py:assert encoded.startswith('sha1$$')
 django/contrib/auth/hashers.py:assert salt == ''
 django/contrib/auth/hashers.py:assert len(salt) == 2
 django/contrib/auth/hashers.py:assert hash is not None  # A
 platform like OpenBSD with a dummy crypt module.
 django/contrib/auth/hashers.py:assert algorithm == self.algorithm
 django/contrib/auth/views.py:assert 'uidb64' in kwargs and 'token'
 in kwargs
 django/contrib/staticfiles/storage.py:assert
 url_path.startswith(settings.STATIC_URL)
 django/dispatch/dispatcher.py:assert callable(receiver),
 "Signal receivers must be callable."
 django/http/multipartparser.py:assert remaining > 0,
 'remaining bytes to read should never go negative'
 django/test/client.py:assert self.__len >= num_bytes, "Cannot read
 more than the available bytes from the HTTP incoming data."
 django/test/utils.py:assert not kwargs
 django/test/utils.py:assert not args
 django/test/testcases.py:assert not self.reset_sequences,
 'reset_sequences cannot be used on TestCase instances'
 django/utils/version.py:assert len(version) == 5
 django/utils/version.py:assert version[3] in ('alpha', 'beta',
 'rc', 'final')
 django/utils/regex_helper.py:assert not flags, (
 django/views/decorators/debug.py:assert isinstance(request,
 HttpRequest), (
 }}}

 The work to finish this off is to decide which ones remaining are worth
 changing given comments above from Tim and Chris. I suspect not many. The
 last one in the list could be; it's potentially user-facing and already
 has a nice exception message, so we can just change to `TypeError`. The
 ones in contrib.auth.hashers look like sanity checks we don't need to
 touch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.05108f06156d4ae68eb1f0b6ec4dfd4e%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-06-01 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Nishant Sagar):

 May I take this ticket and if yes can anyone suggests me the ways to
 proceed as I'm fairly new to this

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1baa8b66fb0e2d7653f7c16b9c21616c%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-19 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"474cc420bf6bc1067e2aaa4b40cf6a08d62096f7" 474cc420]:
 {{{
 #!CommitTicketReference repository=""
 revision="474cc420bf6bc1067e2aaa4b40cf6a08d62096f7"
 Refs #32508 -- Raised Type/ValueError instead of using "assert" in
 django.core.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.7bf0c8f3376f901cfea03995560a84ca%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-19 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak):

 Replying to [comment:19 Daniyal Abbasi]:
 > Next up, I would like to work on removing the usage of assert in
 django.db module.

 Please take into account Tim's
 [https://code.djangoproject.com/ticket/32508#comment:3 comment].

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.7ec1939914e59757955838a0394ff414%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-17 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Daniyal Abbasi):

 I have created a [https://github.com/django/django/pull/14135 PR] to
 remove usage of assert in django.core.

 Next up, I would like to work on removing the usage of assert in django.db
 module. If anyone else is already working on it, do let me know. Thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f674d5af8e661db242ee4df5be3f1567%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-16 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"54d91795408c878ad335226a87a44961d7f646a9" 54d91795]:
 {{{
 #!CommitTicketReference repository=""
 revision="54d91795408c878ad335226a87a44961d7f646a9"
 Refs #32508 -- Raised ImproperlyConfigured instead of using "assert" in
 SessionStorage.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.448e9be09bc232250906c763f4982f7e%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-15 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"775b796d8d13841059850d73986d5dcc2e593077" 775b796]:
 {{{
 #!CommitTicketReference repository=""
 revision="775b796d8d13841059850d73986d5dcc2e593077"
 Refs #32508 -- Raised ValueError instead of using "assert" in lazy().
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f8471e2d84cf2287e604249ee283bf6b%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-11 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Hasan Ramezani):

 I've created a [https://github.com/django/django/pull/14114 PR] to replace
 `assert` in `django.utils`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.355d2bcb4b5c21c820b71d95319a2b59%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-11 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Adam Johnson):

 > I don't think we can sustainably add system checks for every which way
 you might possibly shoot yourself in the foot.

 True - I just get tired of repairing feet 😅

 > I don't know that the issue tracker is the best place to knock this back
 and forth.

 Agree. Let's just stick with the current proposal to remove use of assert
 in prod code. I made an issue for DRF: https://github.com/encode/django-
 rest-framework/issues/7831

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f3aa3f54b58ffe1a54a2777819a3fbf0%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-11 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"a2d5ea626ec6aa4eab6b018c4bce58cb27e20676" a2d5ea62]:
 {{{
 #!CommitTicketReference repository=""
 revision="a2d5ea626ec6aa4eab6b018c4bce58cb27e20676"
 Refs #32508 -- Raised ImproperlyConfigured instead of using "assert" in
 middlewares.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.f388998d773917ba30c5da3355582491%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Carlton Gibson):

 > If a system check is a good idea on DRF...

 Yeah... **if** — note I said **maybe** (with emphasis). I'm kind of -0 on
 this (for here or there) — I don't think we can sustainably add system
 checks for every which way you might possibly shoot yourself in the foot.
 If using `-O` is a bad move, that's something that Python should warn
 about no?

 I don't know that the issue tracker is the best place to knock this back
 and forth. The first four responses here seem against adding a system
 check, without at least doing various other things first, so I think we're
 a way from a consensus **to add** one…

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.3938879676860519692cde0d6272ac5b%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Adam Johnson):

 > It sort of misses the point of Python IMO...

 Sure, but that doesn't stop someone seeing their code is slow, trying it,
 and leaving it in place.

 >  Maybe a system check for DRF is a good idea…

 If a system check is a good idea on DRF I don't see why it wouldn't be a
 good idea in Django itself. Putting it in DRF it would effectively force
 79.5%* of the ecosystem to not use `-O`, so we'd be most of the way. Even
 if django itself stops using `assert` there's an unknown amount of code in
 third party libraries etc. using it.

 *2020 survey stat

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a832f05ff7a6862b54e269d02969163e%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Hasan Ramezani):

 [https://github.com/django/django/pull/14107 PR] for changing asserts in
 admindoc and auth middlewares

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.a0da07024968d39f67175ebed5f202a5%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Carlton Gibson):

 **Maybe** a system check for DRF is a good idea…

  I can't quite decide. I've never run `python -O`. It sort of misses the
 point of Python IMO... — but if someone were to do it, yes. I guess a PR
 with it fully in place would be better than a ticket. 😀

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.d083e9bc72ea8b99a962829ea0de3fc8%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Adam Johnson):

 >  Just as a data-point, DRF makes extensive use of assert for this
 purpose.

 Would you make a ticket for DRF? Or is it just too much work?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.3fc174428b381ea1d17cea3bdae5ddcc%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-10 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by GitHub ):

 In [changeset:"ba9a2b754452b542d3f472f0acce6f940911aced" ba9a2b75]:
 {{{
 #!CommitTicketReference repository=""
 revision="ba9a2b754452b542d3f472f0acce6f940911aced"
 Refs #32508 -- Raised TypeError instead of using "assert" on unsupported
 operations for sliced querysets.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1e8544b0985d09ad25ead0e7eb347024%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-09 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Carlton Gibson):

 > It's also common for library...

 Just as a data-point, DRF makes extensive use of assert for this purpose.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b8fd3a1bce13535bb8db9d63b1ce8f59%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-08 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak):

 I added [https://github.com/django/django/pull/14099 PR] for a good start.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.c02ad19fa088ab0c3332def55f3bbf39%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-06 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Adam Johnson):

 Fair enough, I agree that removing such usage is probably just as valid.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.2156b31d926f7581f2797f7c8a549947%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-04 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Chris Jerdonek):

 I agree with Tim. Before proceeding too far with this, it might be worth
 documenting in the
 [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /coding-style/ coding style guidelines] when `assert` is appropriate so
 you have something to judge cases by. It's useful e.g. when you know an
 invariant should be preserved by Django, but you don't want to regularly
 incur the performance hit when invoked with `-O`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.c8a73688d6bd3d8b8769646f109452b9%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert".

2021-03-04 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Tim Graham):

 I agree anything user-facing should be an exception, but it might not be
 necessary to replace all usages. For example, there might be `assert`
 conditions in the ORM that aren't expected to be triggered unless there's
 some bug in Django. In this case, the `assert` merely helps when
 refactoring, etc.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b61a964a677b4d9b64e286fc2c6ac2cb%40djangoproject.com.


Re: [Django] #32508: Raise proper exceptions instead of using "assert". (was: Add a system check that 'assert' is not disabled)

2021-03-04 Thread Django
#32508: Raise proper exceptions instead of using "assert".
--+
 Reporter:  Adam Johnson  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Core (Other)  |  Version:  dev
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * type:  Uncategorized => Cleanup/optimization
 * component:  Uncategorized => Core (Other)
 * stage:  Unreviewed => Accepted


Comment:

 I agree with Simon. We don't add `assert` to Django anymore,  so I would
 prefer to replace these by proper exceptions (mostly `TypeError` and
 `ValueError`).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.95a8266d6730b673c06bb2cd18c70024%40djangoproject.com.