Cleanups, permissions separation into explicit module, absolute import update

This commit is contained in:
Roberto Rosario
2012-01-02 03:48:26 -04:00
parent 2781a211ec
commit 34311fb17e
107 changed files with 693 additions and 468 deletions

View File

@@ -1,11 +1,13 @@
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ImproperlyConfigured
from navigation.api import register_sidebar_template
from project_tools.api import register_tool
from converter.utils import load_backend
from converter.conf.settings import GRAPHICS_BACKEND
from .utils import load_backend
from .conf.settings import GRAPHICS_BACKEND
formats_list = {'text': _('file formats'), 'view': 'formats_list', 'famfam': 'pictures', 'icon': 'pictures.png'}

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import subprocess
import hashlib
@@ -7,15 +9,13 @@ from common.conf.settings import TEMPORARY_DIRECTORY
from converter.literals import DEFAULT_PAGE_NUMBER, \
DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, DEFAULT_FILE_FORMAT
from converter import backend
from converter.literals import TRANSFORMATION_CHOICES
from converter.literals import TRANSFORMATION_RESIZE, \
TRANSFORMATION_ROTATE, TRANSFORMATION_ZOOM
from converter.literals import DIMENSION_SEPARATOR
from converter.literals import FILE_FORMATS
from converter.utils import cleanup
from converter.runtime import office_converter
from converter.exceptions import OfficeConversionError
from . import backend
from .literals import (TRANSFORMATION_CHOICES, TRANSFORMATION_RESIZE,
TRANSFORMATION_ROTATE, TRANSFORMATION_ZOOM, DIMENSION_SEPARATOR,
FILE_FORMATS)
from .utils import cleanup
from .runtime import office_converter
from .exceptions import OfficeConversionError
HASH_FUNCTION = lambda x: hashlib.sha256(x).hexdigest()

View File

@@ -1,29 +1,29 @@
class ConvertError(Exception):
"""
'''
Base exception for all coverter app exceptions
"""
'''
pass
class UnknownFileFormat(ConvertError):
"""
'''
Raised when the converter backend can't understand a file
"""
'''
pass
class IdentifyError(ConvertError):
"""
'''
Raised by the graphcismagick and imagemagics identify program
"""
'''
pass
class UnkownConvertError(ConvertError):
"""
'''
Raised when an error is found but there is no disernible way to
identify the kind of error
"""
'''
pass

View File

@@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import subprocess
import logging
@@ -6,8 +8,8 @@ from mimetype.api import get_mimetype
from common.conf.settings import TEMPORARY_DIRECTORY
from common.utils import id_generator
from converter.conf.settings import UNOCONV_PATH, UNOCONV_USE_PIPE
from converter.exceptions import (OfficeConversionError,
from .conf.settings import UNOCONV_PATH, UNOCONV_USE_PIPE
from .exceptions import (OfficeConversionError,
OfficeBackendError, UnknownFileFormat)
CACHED_FILE_SUFFIX = u'_office_converter'

View File

@@ -1,5 +1,7 @@
from converter.office_converter import OfficeConverter
from converter.exceptions import OfficeBackendError
from __future__ import absolute_import
from .office_converter import OfficeConverter
from .exceptions import OfficeBackendError
try: