Initial changes to support the new Django 1.6 project structure

This commit is contained in:
Roberto Rosario
2014-06-15 13:13:21 +02:00
parent 7404e36385
commit ec1745b50b
1699 changed files with 160 additions and 73 deletions

View File

@@ -0,0 +1,40 @@
import os
from django.utils.importlib import import_module
def _lazy_load(fn):
_cached = []
def _decorated():
if not _cached:
_cached.append(fn())
return _cached[0]
return _decorated
@_lazy_load
def load_backend():
from converter.conf.settings import GRAPHICS_BACKEND as backend_name
try:
module = import_module('.base', 'converter.backends.%s' % backend_name)
import warnings
warnings.warn(
"Short names for CONVERTER_BACKEND are deprecated; prepend with 'converter.backends.'",
PendingDeprecationWarning
)
return module
except ImportError, e:
# Look for a fully qualified converter backend name
return import_module('.base', backend_name)
def cleanup(filename):
"""
Tries to remove the given filename. Ignores non-existent files
"""
try:
os.remove(filename)
except OSError:
pass