mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Use six to reload module
This commit is contained in:
parent
2353878951
commit
29f5ce7aeb
|
@ -1,4 +1,5 @@
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
from rest_framework.compat import six
|
||||||
from rest_framework.settings import api_settings
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,11 +15,11 @@ def temporary_setting(setting, value, module=None):
|
||||||
setattr(api_settings, setting, value)
|
setattr(api_settings, setting, value)
|
||||||
|
|
||||||
if module is not None:
|
if module is not None:
|
||||||
reload(module)
|
six.moves.reload_module(module)
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
setattr(api_settings, setting, original_value)
|
setattr(api_settings, setting, original_value)
|
||||||
|
|
||||||
if module is not None:
|
if module is not None:
|
||||||
reload(module)
|
six.moves.reload_module(module)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user