mirror of
https://github.com/sprockets/sprockets.mixins.mediatype.git
synced 2024-12-28 11:24:12 +00:00
Prevent meta-class error in top-level imports.
Extended the `ImportError` handling hack to correctly handle the case where we cannot import submodules AND someone is extending one of the exported classes. Previously ContentMixin and ContentSettings were functions when ImportError was raised which causes really confusing errors. The correct solution here is to stop exporting stuff at the top- level and require clients to import from modules but that is for another day.
This commit is contained in:
parent
14f3533517
commit
242a0590e6
1 changed files with 6 additions and 2 deletions
|
@ -14,8 +14,12 @@ except ImportError as error: # pragma no cover
|
|||
def _error_closure(*args, **kwargs):
|
||||
raise error
|
||||
|
||||
ContentMixin = _error_closure
|
||||
ContentSettings = _error_closure
|
||||
class ErrorClosureClass(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
raise error
|
||||
|
||||
ContentMixin = ErrorClosureClass
|
||||
ContentSettings = ErrorClosureClass
|
||||
add_binary_content_type = _error_closure
|
||||
add_text_content_type = _error_closure
|
||||
set_default_content_type = _error_closure
|
||||
|
|
Loading…
Reference in a new issue