Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#35547 closed Cleanup/optimization (fixed)

reset_queries not included in __all__ of django/db/__init__.py

Reported by: AjmalPonneth Owned by: AjmalPonneth
Component: Database layer (models, ORM) Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Sarah Boyce)

Currently, the reset_queries method cannot be imported via from django.db import *.

Change History (11)

comment:2 by Sarah Boyce, 5 months ago

Triage Stage: UnreviewedAccepted

Thank you, this is documented and so we should be able to import 👍

comment:3 by Sarah Boyce, 5 months ago

Has patch: set
Patch needs improvement: set

comment:4 by Sarah Boyce, 5 months ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham, 5 months ago

I think the summary is slightly misleading. It can be imported with from django.db import reset_queries but not with from django.db import *, right?

comment:6 by AjmalPonneth, 5 months ago

Currently, the reset_queries function is not importable from django.db. Since it's not included in the __all__ from django.db.

in reply to:  6 ; comment:7 by Mariusz Felisiak, 5 months ago

Replying to AjmalPonneth:

Currently, the reset_queries function is not importable from django.db. Since it's not included in the __all__ from django.db.

That's not true. reset_queries can be imported from django.db even without including it in __all__, e.g. https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/test/utils.py#L25.

in reply to:  5 comment:8 by Sarah Boyce, 5 months ago

Description: modified (diff)
Summary: reset_queries cannot be imported from django.dbreset_queries not included in __all__ of django/db/__init__.py

Replying to Tim Graham:

I think the summary is slightly misleading. It can be imported with from django.db import reset_queries but not with from django.db import *, right?

Yes, it's misleading 👍

in reply to:  7 comment:9 by AjmalPonneth, 5 months ago

Replying to Mariusz Felisiak:

Replying to AjmalPonneth:

Currently, the reset_queries function is not importable from django.db. Since it's not included in the __all__ from django.db.

That's not true. reset_queries can be imported from django.db even without including it in __all__, e.g. https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/test/utils.py#L25.

I agree. But the linters will complain like this reset_queries not declared in __all__

comment:10 by Sarah Boyce <42296566+sarahboyce@…>, 5 months ago

Resolution: fixed
Status: assignedclosed

In 2a082d8:

Fixed #35547 -- Added reset_queries to django.db.all.

comment:11 by Sarah Boyce <42296566+sarahboyce@…>, 5 months ago

In 56180fb:

[5.1.x] Fixed #35547 -- Added reset_queries to django.db.all.

Backport of 2a082d827de05528cb976109f219ec9b00490d2d from main.

Note: See TracTickets for help on using tickets.
Back to Top