MediaCMS backend, initial commit

This commit is contained in:
Markos Gogoulos
2020-12-15 23:33:43 +02:00
commit 75430de2e0
85 changed files with 10558 additions and 0 deletions

22
uploader/utils.py Normal file
View File

@@ -0,0 +1,22 @@
from django.core.exceptions import ImproperlyConfigured
from importlib import import_module
def import_class(path):
path_bits = path.split(".")
if len(path_bits) < 2:
message = "'{0}' is not a complete Python path.".format(path)
raise ImproperlyConfigured(message)
class_name = path_bits.pop()
module_path = ".".join(path_bits)
module_itself = import_module(module_path)
if not hasattr(module_itself, class_name):
message = "The Python module '{}' has no '{}' class.".format(
module_path, class_name
)
raise ImportError(message)
return getattr(module_itself, class_name)