Merge lp:~james-w/python-timeline-django/clean-env into lp:python-timeline-django
Status: | Merged |
---|---|
Approved by: | James Westby |
Approved revision: | 24 |
Merged at revision: | 23 |
Proposed branch: | lp:~james-w/python-timeline-django/clean-env |
Merge into: | lp:python-timeline-django |
Diff against target: |
164 lines (+79/-11) 4 files modified
timeline_django/hooks.py (+12/-7) timeline_django/tests/test_hooks.py (+6/-0) timeline_django/tests/test_wsgi.py (+48/-3) timeline_django/wsgi.py (+13/-1) |
To merge this branch: | bzr merge lp:~james-w/python-timeline-django/clean-env |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Review via email: mp+232704@code.launchpad.net |
Commit message
Be more careful about leaking objects.
1. Register signals with a dispatch_uid so that if register is called
twice there aren't double receivers. There is a very slim chance that
someone could two want two sets of receivers with timeline_factories
that get different timelines. In that case this should be rewritten
to not use dispatch_uid and offer a disconnect method that can be
used in tests etc.
2. Re-set the environ stored in the thread local after the wsgi response
is delivered. In a case where some requests go through wsgi and some
don't (e.g. tests) the environ would leak in to those that don't use
wsgi. This could lead to an ever-growing timeline.
Description of the change
Hi,
This fixes the problems that timeline was causing in the sca test suite.
Thanks,
James
Looks good!