File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1111import logging
1212import subprocess
1313
14- from django .utils .module_loading import import_by_path
14+ try :
15+ from django .utils .module_loading import import_string
16+ except ImportError :
17+ from django .utils .module_loading import import_by_path as import_string
1518
1619from converter .ffmpeg import FFMpeg , FFMpegError , FFMpegConvertError
1720
@@ -37,7 +40,7 @@ def get_encoder_class(import_path=None):
3740 :returns: The encoder class.
3841 :rtype: class
3942 """
40- return import_by_path (import_path or settings .ENCODE_DEFAULT_ENCODER_CLASS )
43+ return import_string (import_path or settings .ENCODE_DEFAULT_ENCODER_CLASS )
4144
4245
4346class BaseEncoder (object ):
Original file line number Diff line number Diff line change @@ -40,8 +40,14 @@ def test_none(self):
4040 """
4141 Retrieving a non-existing class raises an exception.
4242 """
43- self .assertRaises (ImproperlyConfigured , encoders .get_encoder_class ,
44- 'does.not.Exist' )
43+ module_path = 'does.not.Exist'
44+ try :
45+ # django >= 1.7
46+ from django .utils .module_loading import import_string
47+ exception = ImportError
48+ except :
49+ exception = ImproperlyConfigured
50+ self .assertRaises (exception , encoders .get_encoder_class , module_path )
4551
4652
4753class BasicEncoderTestCase (WebTest , DummyDataMixin ):
You can’t perform that action at this time.
0 commit comments