diff --git a/mayan/apps/acls/apps.py b/mayan/apps/acls/apps.py index 9f9cc2958f..8f746bd477 100644 --- a/mayan/apps/acls/apps.py +++ b/mayan/apps/acls/apps.py @@ -45,7 +45,7 @@ class ACLsApp(MayanAppConfig): 'acls:acl_class_multiple_grant', 'acls:acl_class_multiple_revoke' ], - ) + ) menu_setup.bind_links(links=[link_acl_setup_valid_classes]) menu_sidebar.bind_links(links=[link_acl_holder_new], sources=[AccessObject]) diff --git a/mayan/apps/authentication/forms.py b/mayan/apps/authentication/forms.py index 3509fecc88..68c6db3a2f 100644 --- a/mayan/apps/authentication/forms.py +++ b/mayan/apps/authentication/forms.py @@ -13,10 +13,12 @@ class EmailAuthenticationForm(forms.Form): """ A form to use email address authentication """ - email = forms.CharField(label=_('Email'), max_length=254, - widget=EmailInput() + email = forms.CharField( + label=_('Email'), max_length=254, widget=EmailInput() + ) + password = forms.CharField( + label=_('Password'), widget=forms.PasswordInput ) - password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) error_messages = { 'invalid_login': _('Please enter a correct email and password. ' diff --git a/mayan/apps/common/apps.py b/mayan/apps/common/apps.py index b9646ad3be..8699a157e4 100644 --- a/mayan/apps/common/apps.py +++ b/mayan/apps/common/apps.py @@ -1,11 +1,10 @@ from __future__ import absolute_import, unicode_literals import logging -import tempfile from django import apps from django.conf import settings -from django.conf.urls import include, patterns, url +from django.conf.urls import include, url from django.contrib.auth.signals import user_logged_in from django.db.models.signals import post_migrate, post_save from django.utils.translation import ugettext_lazy as _ @@ -23,8 +22,6 @@ from .menus import ( menu_facet, menu_main, menu_secondary, menu_setup, menu_tools ) from .models import AnonymousUserSingleton -from .settings import setting_temporary_directory -from .utils import validate_path logger = logging.getLogger(__name__) @@ -40,10 +37,9 @@ class MayanAppConfig(apps.AppConfig): def ready(self): from mayan.urls import urlpatterns - if self.app_url: top_url = '{}/'.format(self.app_url) - elif not self.app_url is None: + elif self.app_url is not None: top_url = '' else: top_url = '{}/'.format(self.name) @@ -77,7 +73,3 @@ class CommonApp(MayanAppConfig): post_migrate.connect(create_anonymous_user, dispatch_uid='create_anonymous_user', sender=self) user_logged_in.connect(user_locale_profile_session_config, dispatch_uid='user_locale_profile_session_config', sender=settings.AUTH_USER_MODEL) post_save.connect(user_locale_profile_create, dispatch_uid='user_locale_profile_create', sender=settings.AUTH_USER_MODEL) - - # TODO: Create temp directory and update setting if /tmp not found/writable or value == None - #if (not validate_path(setting_temporary_directory.value)) or (not setting_temporary_directory.value): - # setattr(common_settings, 'setting_temporary_directory.value', tempfile.mkdtemp()) diff --git a/mayan/apps/common/utils.py b/mayan/apps/common/utils.py index 04e44f3316..70e22fb304 100644 --- a/mayan/apps/common/utils.py +++ b/mayan/apps/common/utils.py @@ -7,7 +7,6 @@ import types from django.conf import settings from django.contrib.auth.models import User -from django.contrib.contenttypes.models import ContentType from django.utils.datastructures import MultiValueDict from django.utils.http import urlquote as django_urlquote from django.utils.http import urlencode as django_urlencode diff --git a/mayan/apps/converter/classes.py b/mayan/apps/converter/classes.py index f26a9f2d3b..a4d6825adc 100644 --- a/mayan/apps/converter/classes.py +++ b/mayan/apps/converter/classes.py @@ -73,6 +73,7 @@ CONVERTER_OFFICE_FILE_MIMETYPES = ( 'text/rtf', ) + class ConverterBase(object): @staticmethod def soffice(file_object): diff --git a/mayan/apps/django_gpg/tests.py b/mayan/apps/django_gpg/tests.py index 9a84454f92..f5c69070c4 100644 --- a/mayan/apps/django_gpg/tests.py +++ b/mayan/apps/django_gpg/tests.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import shutil -from django.core.files.base import File from django.test import TestCase from .api import GPG, Key diff --git a/mayan/apps/django_gpg/views.py b/mayan/apps/django_gpg/views.py index 11527f5c5b..fea36f83ea 100644 --- a/mayan/apps/django_gpg/views.py +++ b/mayan/apps/django_gpg/views.py @@ -15,7 +15,6 @@ from common.utils import encapsulate from permissions.models import Permission from .api import Key -from .exceptions import KeyImportError from .forms import KeySearchForm from .permissions import ( PERMISSION_KEY_DELETE, PERMISSION_KEY_RECEIVE, PERMISSION_KEY_VIEW, diff --git a/mayan/apps/documents/apps.py b/mayan/apps/documents/apps.py index 5e016d1d90..ec0dc35920 100644 --- a/mayan/apps/documents/apps.py +++ b/mayan/apps/documents/apps.py @@ -1,7 +1,5 @@ from __future__ import absolute_import, unicode_literals -import tempfile - from django.utils.translation import ugettext_lazy as _ from actstream import registry @@ -15,7 +13,7 @@ from common import ( from common.api import register_maintenance_links from common.classes import ModelAttribute from common.signals import post_initial_setup -from common.utils import encapsulate, validate_path +from common.utils import encapsulate from converter.links import link_transformation_list from converter.permissions import ( PERMISSION_TRANSFORMATION_CREATE, @@ -74,10 +72,6 @@ class DocumentsApp(MayanAppConfig): def ready(self): super(DocumentsApp, self).ready() - # TODO: validate cache_path or create new - #if (not validate_path(document_settings.CACHE_PATH)) or (not document_settings.CACHE_PATH): - # setattr(document_settings, 'CACHE_PATH', tempfile.mkdtemp()) - APIEndPoint('documents') MissingItem(label=_('Create a document type'), description=_('Every uploaded document must be assigned a document type, it is the basic way Mayan EDMS categorizes documents.'), condition=lambda: not DocumentType.objects.exists(), view='documents:document_type_list') diff --git a/mayan/apps/documents/models.py b/mayan/apps/documents/models.py index 47ed3fe8a5..dae7270d46 100644 --- a/mayan/apps/documents/models.py +++ b/mayan/apps/documents/models.py @@ -410,8 +410,6 @@ class DocumentVersion(models.Model): logger.debug('Intermidiate file "%s" found.', cache_filename) return open(cache_filename) - #converter = converter_class(file_object=open(cache_filename)) - #converter.seek(0) else: logger.debug('Intermidiate file "%s" not found.', cache_filename) @@ -539,7 +537,7 @@ class DocumentPage(models.Model): file_object.write(page_image.getvalue()) except Exception as exception: # Cleanup in case of error - logger.error('Error creating page cache file "%s".', cache_filename) + logger.error('Error creating page cache file "%s"; %s', cache_filename, exception) fs_cleanup(cache_filename) raise diff --git a/mayan/apps/documents/views.py b/mayan/apps/documents/views.py index 362086947d..a0022c8b1c 100644 --- a/mayan/apps/documents/views.py +++ b/mayan/apps/documents/views.py @@ -21,8 +21,7 @@ from common.utils import encapsulate, pretty_size from common.views import ParentChildListView, SingleObjectListView from common.widgets import two_state_template from converter.literals import ( - DEFAULT_FILE_FORMAT_MIMETYPE, DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION, - DEFAULT_ZOOM_LEVEL + DEFAULT_PAGE_NUMBER, DEFAULT_ROTATION, DEFAULT_ZOOM_LEVEL ) from converter.models import Transformation from converter.permissions import PERMISSION_TRANSFORMATION_DELETE diff --git a/mayan/apps/events/models.py b/mayan/apps/events/models.py index deb7694dfd..19f187d2e2 100644 --- a/mayan/apps/events/models.py +++ b/mayan/apps/events/models.py @@ -17,5 +17,3 @@ class EventType(models.Model): class Meta: verbose_name = _('Event type') verbose_name_plural = _('Event types') - - diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index df62d56a03..fe0c8e1793 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -236,18 +236,6 @@ class Link(object): return resolved_link -class ModelListColumn(object): - _model_list_columns = {} - - @classmethod - def get_model(cls, model): - return cls._model_list_columns.get(model) - - def __init__(self, model, name, attribute): - self.__class__._model_list_columns.setdefault(model, []) - self.__class__._model_list_columns[model].extend(columns) - - class SourceColumn(object): _registry = {} diff --git a/mayan/apps/navigation/forms.py b/mayan/apps/navigation/forms.py index bd098de4f8..b2093e3a35 100644 --- a/mayan/apps/navigation/forms.py +++ b/mayan/apps/navigation/forms.py @@ -8,20 +8,7 @@ class MultiItemForm(forms.Form): def __init__(self, *args, **kwargs): actions = kwargs.pop('actions', []) super(MultiItemForm, self).__init__(*args, **kwargs) - choices = [] - group = [] - for action in actions: - if not action[0]: - if group: - choices.append((link_spacer['text'], group)) - group = [] - else: - group.append(action) - - if choices: - self.fields['action'].choices = choices - else: - self.fields['action'].choices = group + self.fields['action'].choices = actions action = forms.ChoiceField(label=_('Actions'), required=False) diff --git a/mayan/apps/ocr/api.py b/mayan/apps/ocr/api.py index 6cf9105815..726de49ea4 100644 --- a/mayan/apps/ocr/api.py +++ b/mayan/apps/ocr/api.py @@ -9,12 +9,8 @@ import sh from common.settings import setting_temporary_directory from .exceptions import UnpaperError -from .literals import ( - DEFAULT_OCR_FILE_EXTENSION, DEFAULT_OCR_FILE_FORMAT, UNPAPER_FILE_FORMAT -) from .parsers import parse_document_page from .parsers.exceptions import ParserError, ParserUnknownFile -from .runtime import ocr_backend from .settings import UNPAPER_PATH logger = logging.getLogger(__name__) diff --git a/mayan/apps/ocr/apps.py b/mayan/apps/ocr/apps.py index 84bfde59f3..8edc0c35a5 100644 --- a/mayan/apps/ocr/apps.py +++ b/mayan/apps/ocr/apps.py @@ -28,10 +28,7 @@ from .links import ( link_entry_re_queue, link_entry_re_queue_multiple ) from .models import DocumentVersionOCRError -from .permissions import ( - PERMISSION_OCR_DOCUMENT, PERMISSION_OCR_CONTENT_VIEW, - PERMISSION_DOCUMENT_TYPE_OCR_SETUP -) +from .permissions import PERMISSION_OCR_DOCUMENT, PERMISSION_OCR_CONTENT_VIEW from .settings import setting_pdftotext_path, setting_tesseract_path, setting_unpaper_path from .tasks import task_do_ocr diff --git a/mayan/apps/ocr/backends/__init__.py b/mayan/apps/ocr/backends/__init__.py index 8b13789179..e69de29bb2 100644 --- a/mayan/apps/ocr/backends/__init__.py +++ b/mayan/apps/ocr/backends/__init__.py @@ -1 +0,0 @@ - diff --git a/mayan/apps/ocr/classes.py b/mayan/apps/ocr/classes.py index ea877ef606..3e8165cf33 100644 --- a/mayan/apps/ocr/classes.py +++ b/mayan/apps/ocr/classes.py @@ -4,9 +4,6 @@ import logging from converter import converter_class -from .literals import ( - DEFAULT_OCR_FILE_EXTENSION, DEFAULT_OCR_FILE_FORMAT, UNPAPER_FILE_FORMAT -) from .models import DocumentPageContent from .parsers import parse_document_page from .parsers.exceptions import ParserError, ParserUnknownFile @@ -25,7 +22,7 @@ class OCRBackendBase(object): image = page.get_image() logger.info('Processing page: %d of document version: %s', page.page_number, document_version) document_page_content, created = DocumentPageContent.objects.get_or_create(document_page=page) - result = self.execute(file_object=image, language=language) + result = self.execute(file_object=image, language=language) document_page_content.content = self.execute(file_object=image, language=language) document_page_content.save() image.close() diff --git a/mayan/apps/ocr/literals.py b/mayan/apps/ocr/literals.py index 3a7b1360dc..86881c7d23 100644 --- a/mayan/apps/ocr/literals.py +++ b/mayan/apps/ocr/literals.py @@ -1,6 +1,3 @@ from __future__ import unicode_literals -DEFAULT_OCR_FILE_FORMAT = 'tiff' -DEFAULT_OCR_FILE_EXTENSION = 'tif' LOCK_EXPIRE = 60 * 10 # Adjust to worst case scenario -UNPAPER_FILE_FORMAT = 'ppm' diff --git a/mayan/apps/user_management/views.py b/mayan/apps/user_management/views.py index 798302d028..f647028943 100644 --- a/mayan/apps/user_management/views.py +++ b/mayan/apps/user_management/views.py @@ -228,8 +228,8 @@ class UserGroupsView(AssignRemoveView): def dispatch(self, request, *args, **kwargs): Permission.objects.check_permissions(request.user, [PERMISSION_USER_EDIT]) self.user = get_object_or_404(User, pk=self.kwargs['user_id']) - self.left_list_title=_('Non groups of user: %s') % self.user - self.right_list_title=_('Groups of user: %s') % self.user + self.left_list_title = _('Non groups of user: %s') % self.user + self.right_list_title = _('Groups of user: %s') % self.user return super(UserGroupsView, self).dispatch(request, *args, **kwargs) diff --git a/mayan/settings/development.py b/mayan/settings/development.py index 705b2b5667..e6c99d5578 100644 --- a/mayan/settings/development.py +++ b/mayan/settings/development.py @@ -34,22 +34,22 @@ LOGGING = { }, }, 'handlers': { - 'console':{ - 'level':'DEBUG', - 'class':'logging.StreamHandler', + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', 'formatter': 'intermediate' } }, 'loggers': { 'documents': { - 'handlers':['console'], + 'handlers': ['console'], 'propagate': True, - 'level':'DEBUG', + 'level': 'DEBUG', }, 'common': { - 'handlers':['console'], + 'handlers': ['console'], 'propagate': True, - 'level':'DEBUG', + 'level': 'DEBUG', }, } }