Fix pending errors of the vendors/bc 33 merge
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
__title__ = 'Mayan EDMS'
|
__title__ = 'Mayan EDMS'
|
||||||
__version__ = '3.2.8'
|
__version__ = '3.3beta1'
|
||||||
__build__ = 0x030208
|
__build__ = 0x030208
|
||||||
__build_string__ = 'v3.2.8_Tue Oct 1 13:31:40 2019 -0400'
|
__build_string__ = 'v3.2.8-245-gce7c805251_Mon Oct 7 11:01:43 2019 -0400'
|
||||||
__django_version__ = '1.11'
|
__django_version__ = '1.11'
|
||||||
__author__ = 'Roberto Rosario'
|
__author__ = 'Roberto Rosario'
|
||||||
__author_email__ = 'roberto.rosario@mayan-edms.com'
|
__author_email__ = 'roberto.rosario@mayan-edms.com'
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ link_documentation = Link(
|
|||||||
link_object_error_list = Link(
|
link_object_error_list = Link(
|
||||||
icon_class_path='mayan.apps.common.icons.icon_object_error_list',
|
icon_class_path='mayan.apps.common.icons.icon_object_error_list',
|
||||||
kwargs=get_kwargs_factory('resolved_object'),
|
kwargs=get_kwargs_factory('resolved_object'),
|
||||||
icon_class_path='mayan.apps.common.icons.icon_object_error_list',
|
|
||||||
permissions=(permission_error_log_view,), text=_('Errors'),
|
permissions=(permission_error_log_view,), text=_('Errors'),
|
||||||
view='common:object_error_list',
|
view='common:object_error_list',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -410,12 +410,6 @@ class DocumentStatesApp(MayanAppConfig):
|
|||||||
WorkflowTransition,
|
WorkflowTransition,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
menu_secondary.bind_links(
|
|
||||||
links=(link_setup_workflow_transition_field_create,),
|
|
||||||
sources=(
|
|
||||||
WorkflowTransition,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
menu_secondary.bind_links(
|
menu_secondary.bind_links(
|
||||||
links=(link_workflow_runtime_proxy_list,),
|
links=(link_workflow_runtime_proxy_list,),
|
||||||
sources=(
|
sources=(
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
'''
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
from converter import converter_class
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class OCRBackendBase(object):
|
|
||||||
def execute(self, file_object, language=None, process_barcodes=True, process_text=True, transformations=None):
|
|
||||||
self.language = language
|
|
||||||
self.process_barcodes = process_barcodes
|
|
||||||
self.process_text = process_text
|
|
||||||
|
|
||||||
if not transformations:
|
|
||||||
transformations = []
|
|
||||||
|
|
||||||
self.converter = converter_class(file_object=file_object)
|
|
||||||
|
|
||||||
for transformation in transformations:
|
|
||||||
self.converter.transform(transformation=transformation)
|
|
||||||
|
|
||||||
self.image = Image.open(self.converter.get_page())
|
|
||||||
'''
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
'''from __future__ import unicode_literals
|
|
||||||
|
|
||||||
|
|
||||||
class OCRError(Exception):
|
|
||||||
"""
|
|
||||||
Raised by the OCR backend
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class UnpaperError(Exception):
|
|
||||||
"""
|
|
||||||
Raised by unpaper
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
'''
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django import forms
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
|
|
||||||
from .models import Redaction
|
|
||||||
|
|
||||||
|
|
||||||
class RedactionCoordinatesForm(forms.ModelForm):
|
|
||||||
class Meta:
|
|
||||||
fields = ('arguments',)
|
|
||||||
model = Redaction
|
|
||||||
widgets = {
|
|
||||||
'arguments': forms.widgets.Textarea(attrs={'class': 'hidden'}),
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
|
|
||||||
from mayan.apps.navigation.classes import Link
|
|
||||||
|
|
||||||
from .permissions import (
|
|
||||||
permission_redaction_create, permission_redaction_delete,
|
|
||||||
permission_redaction_edit, permission_redaction_view
|
|
||||||
)
|
|
||||||
|
|
||||||
link_redaction_create = Link(
|
|
||||||
icon_class_path='mayan.apps.redactions.icons.icon_redaction_create',
|
|
||||||
permissions=(permission_redaction_create,), text=_('Create redaction'),
|
|
||||||
view='redactions:redaction_create', args='resolved_object.id'
|
|
||||||
)
|
|
||||||
link_redaction_delete = Link(
|
|
||||||
icon_class_path='mayan.apps.redactions.icons.icon_redaction_delete',
|
|
||||||
permissions=(permission_redaction_delete,), tags='dangerous',
|
|
||||||
text=_('Delete'), view='redactions:redaction_delete',
|
|
||||||
args='resolved_object.id'
|
|
||||||
)
|
|
||||||
link_redaction_edit = Link(
|
|
||||||
icon_class_path='mayan.apps.redactions.icons.icon_redaction_edit',
|
|
||||||
permissions=(permission_redaction_edit,), text=_('Edit'),
|
|
||||||
view='redactions:redaction_edit', args='resolved_object.id'
|
|
||||||
)
|
|
||||||
link_redaction_list = Link(
|
|
||||||
icon_class_path='mayan.apps.redactions.icons.icon_redactions',
|
|
||||||
permissions=(permission_redaction_view,), text=_('Redactions'),
|
|
||||||
view='redactions:redaction_list', args='resolved_object.id'
|
|
||||||
)
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
from rest_framework import serializers
|
|
||||||
|
|
||||||
|
|
||||||
class DocumentVersionOCRSerializer(serializers.Serializer):
|
|
||||||
document_version_id = serializers.IntegerField()
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from django.conf.urls import url
|
|
||||||
|
|
||||||
from .views import (
|
|
||||||
RedactionCreateView, RedactionDeleteView, RedactionEditView,
|
|
||||||
RedactionListView,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
url(
|
|
||||||
regex=r'^document_pages/(?P<pk>\d+)/redactions/create/$',
|
|
||||||
view=RedactionCreateView.as_view(), name='redaction_create'
|
|
||||||
),
|
|
||||||
url(
|
|
||||||
regex=r'^document_pages/(?P<pk>\d+)/redactions/$',
|
|
||||||
view=RedactionListView.as_view(), name='redaction_list'
|
|
||||||
),
|
|
||||||
url(
|
|
||||||
regex=r'^redactions/(?P<pk>\d+)/delete/$',
|
|
||||||
view=RedactionDeleteView.as_view(), name='redaction_delete'
|
|
||||||
),
|
|
||||||
url(
|
|
||||||
regex=r'^redactions/(?P<pk>\d+)/edit/$',
|
|
||||||
view=RedactionEditView.as_view(), name='redaction_edit'
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
api_urls = []
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
|
||||||
from django.template import RequestContext
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
|
|
||||||
from mayan.apps.common.generics import (
|
|
||||||
SingleObjectCreateView, SingleObjectDeleteView, SingleObjectEditView,
|
|
||||||
SingleObjectListView
|
|
||||||
)
|
|
||||||
from mayan.apps.common.mixins import ExternalObjectMixin
|
|
||||||
from mayan.apps.converter.transformations import TransformationDrawRectanglePercent
|
|
||||||
from mayan.apps.documents.models import DocumentPage
|
|
||||||
|
|
||||||
from .forms import RedactionCoordinatesForm
|
|
||||||
from .icons import icon_redactions
|
|
||||||
from .links import link_redaction_create
|
|
||||||
from .models import Redaction
|
|
||||||
from .permissions import (
|
|
||||||
permission_redaction_create, permission_redaction_delete,
|
|
||||||
permission_redaction_edit, permission_redaction_view
|
|
||||||
)
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class RedactionCreateView(ExternalObjectMixin, SingleObjectCreateView):
|
|
||||||
external_object_class = DocumentPage
|
|
||||||
external_object_pk_url_kwarg = 'pk'
|
|
||||||
form_class = RedactionCoordinatesForm
|
|
||||||
model = Redaction
|
|
||||||
object_permission = permission_redaction_create
|
|
||||||
template_name = 'redactions/cropper.html'
|
|
||||||
|
|
||||||
def form_valid(self, form):
|
|
||||||
instance = form.save(commit=False)
|
|
||||||
instance.content_object = self.external_object
|
|
||||||
instance.name = TransformationDrawRectanglePercent.name
|
|
||||||
instance.save()
|
|
||||||
return super(RedactionCreateView, self).form_valid(form)
|
|
||||||
|
|
||||||
def get_extra_context(self, **kwargs):
|
|
||||||
context = {
|
|
||||||
'document_page': self.external_object,
|
|
||||||
'redaction': self.object,
|
|
||||||
'title': _('Create redaction for: %s') % self.external_object
|
|
||||||
}
|
|
||||||
|
|
||||||
return context
|
|
||||||
|
|
||||||
def get_post_action_redirect(self):
|
|
||||||
return reverse(
|
|
||||||
viewname='redactions:redaction_list', kwargs={
|
|
||||||
'pk': self.external_object.pk
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RedactionDeleteView(SingleObjectDeleteView):
|
|
||||||
model = Redaction
|
|
||||||
object_permission = permission_redaction_delete
|
|
||||||
|
|
||||||
def get_post_action_redirect(self):
|
|
||||||
return reverse(
|
|
||||||
viewname='redactions:redaction_list', kwargs={
|
|
||||||
'pk': self.object.content_object.pk
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_extra_context(self):
|
|
||||||
return {
|
|
||||||
'content_object': self.object.content_object,
|
|
||||||
'navigation_object_list': ('content_object', 'redaction'),
|
|
||||||
'previous': reverse(
|
|
||||||
viewname='redactions:redaction_list', kwargs={
|
|
||||||
'pk': self.object.content_object.pk
|
|
||||||
}
|
|
||||||
),
|
|
||||||
'redaction': self.object,
|
|
||||||
'title': _(
|
|
||||||
'Delete refaction for: %(content_object)s?'
|
|
||||||
) % {
|
|
||||||
'content_object': self.object.content_object
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class RedactionEditView(SingleObjectEditView):
|
|
||||||
form_class = RedactionCoordinatesForm
|
|
||||||
model = Redaction
|
|
||||||
object_permission = permission_redaction_edit
|
|
||||||
template_name = 'redactions/cropper.html'
|
|
||||||
|
|
||||||
def get_extra_context(self, **kwargs):
|
|
||||||
context = {
|
|
||||||
'document_page': self.object.content_object,
|
|
||||||
'navigation_object_list': ['document_page', 'redaction'],
|
|
||||||
'redaction': self.object,
|
|
||||||
'title': _('Edit redaction: %s') % self.object
|
|
||||||
}
|
|
||||||
|
|
||||||
return context
|
|
||||||
|
|
||||||
def get_post_action_redirect(self):
|
|
||||||
return reverse(
|
|
||||||
viewname='redactions:redaction_list', kwargs={
|
|
||||||
'pk': self.object.content_object.pk
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RedactionListView(ExternalObjectMixin, SingleObjectListView):
|
|
||||||
external_object_class = DocumentPage
|
|
||||||
object_permission = permission_redaction_view
|
|
||||||
external_object_pk_url_kwarg = 'pk'
|
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
|
||||||
return super(RedactionListView, self).dispatch(
|
|
||||||
request, *args, **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_extra_context(self):
|
|
||||||
return {
|
|
||||||
'hide_object': True,
|
|
||||||
'object': self.external_object,
|
|
||||||
'no_results_icon': icon_redactions,
|
|
||||||
'no_results_main_link': link_redaction_create.resolve(
|
|
||||||
context=RequestContext(
|
|
||||||
request=self.request, dict_={
|
|
||||||
'object': self.external_object
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'no_results_text': _(
|
|
||||||
'Redactions allow removing access to confidential and '
|
|
||||||
'sensitive information without having to modify the document.'
|
|
||||||
),
|
|
||||||
'no_results_title': _('No existing redactions'),
|
|
||||||
'title': _('Redactions for: %s') % self.external_object,
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_source_queryset(self):
|
|
||||||
return Redaction.objects.get_for_object(
|
|
||||||
obj=self.external_object
|
|
||||||
).filter(name__startswith='draw')
|
|
||||||
@@ -123,7 +123,6 @@ INSTALLED_APPS = (
|
|||||||
'mayan.apps.mayan_statistics',
|
'mayan.apps.mayan_statistics',
|
||||||
'mayan.apps.metadata',
|
'mayan.apps.metadata',
|
||||||
'mayan.apps.mirroring',
|
'mayan.apps.mirroring',
|
||||||
'mayan.apps.redactions',
|
|
||||||
'mayan.apps.ocr',
|
'mayan.apps.ocr',
|
||||||
'mayan.apps.redactions',
|
'mayan.apps.redactions',
|
||||||
'mayan.apps.sources',
|
'mayan.apps.sources',
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
Pillow==6.0.0
|
Pillow==6.0.0
|
||||||
PyPDF2==1.26.0
|
PyPDF2==1.26.0
|
||||||
PyYAML==5.1.1
|
PyYAML==5.1.1
|
||||||
celery==4.3.0
|
|
||||||
django-activity-stream==0.7.0
|
django-activity-stream==0.7.0
|
||||||
django-celery-beat==1.5.0
|
|
||||||
django-colorful==1.3
|
django-colorful==1.3
|
||||||
django-cors-headers==2.5.2
|
django-cors-headers==2.5.2
|
||||||
django-downloadview==1.9
|
django-downloadview==1.9
|
||||||
django-environ==0.4.5
|
|
||||||
django-formtools==2.1
|
django-formtools==2.1
|
||||||
django-mathfilters==0.4.0
|
django-mathfilters==0.4.0
|
||||||
django-model-utils==3.1.2
|
django-model-utils==3.1.2
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -60,13 +60,10 @@ django==1.11.24
|
|||||||
Pillow==6.0.0
|
Pillow==6.0.0
|
||||||
PyPDF2==1.26.0
|
PyPDF2==1.26.0
|
||||||
PyYAML==5.1.1
|
PyYAML==5.1.1
|
||||||
celery==4.3.0
|
|
||||||
django-activity-stream==0.7.0
|
django-activity-stream==0.7.0
|
||||||
django-celery-beat==1.5.0
|
|
||||||
django-colorful==1.3
|
django-colorful==1.3
|
||||||
django-cors-headers==2.5.2
|
django-cors-headers==2.5.2
|
||||||
django-downloadview==1.9
|
django-downloadview==1.9
|
||||||
django-environ==0.4.5
|
|
||||||
django-formtools==2.1
|
django-formtools==2.1
|
||||||
django-mathfilters==0.4.0
|
django-mathfilters==0.4.0
|
||||||
django-model-utils==3.1.2
|
django-model-utils==3.1.2
|
||||||
|
|||||||
Reference in New Issue
Block a user