From 6d13b5c811d21191baac0099ce28b8b88b2d0093 Mon Sep 17 00:00:00 2001 From: Gustavo Fonseca Date: Mon, 3 Oct 2016 17:46:13 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Separa=20as=20valida=C3=A7=C3=B5es=20de=20S?= =?UTF-8?q?ciELO=20BR=20das=20demais,=20na=20interface=20do=20stylechecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 +- scielomanager/validator/forms.py | 1 + .../validator/templates/validator/stylechecker.html | 9 ++++++++- scielomanager/validator/tests/doubles.py | 2 +- scielomanager/validator/utils.py | 5 +++-- scielomanager/validator/views.py | 8 +++++++- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4e175c2a..90058441 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ yuicompressor jsonfield django-tastypie==0.9.16 django-htmlmin==0.7.0 -packtools==1.2 +packtools==1.3.1 Celery django-celery django-kombu diff --git a/scielomanager/validator/forms.py b/scielomanager/validator/forms.py index 3e48bfba..a89390b6 100644 --- a/scielomanager/validator/forms.py +++ b/scielomanager/validator/forms.py @@ -6,6 +6,7 @@ class XMLUploadForm(forms.Form): + add_scielo_br_rules = forms.BooleanField(required=False, initial=True) file = forms.FileField(label=_("File")) def clean_file(self): diff --git a/scielomanager/validator/templates/validator/stylechecker.html b/scielomanager/validator/templates/validator/stylechecker.html index a33d566a..40f72491 100644 --- a/scielomanager/validator/templates/validator/stylechecker.html +++ b/scielomanager/validator/templates/validator/stylechecker.html @@ -49,7 +49,14 @@

{% trans "SciELO Style Checker" %}

{% endfor %} {% endwith %} - +
+ +
diff --git a/scielomanager/validator/tests/doubles.py b/scielomanager/validator/tests/doubles.py index d6bdc6ac..912c8fdf 100644 --- a/scielomanager/validator/tests/doubles.py +++ b/scielomanager/validator/tests/doubles.py @@ -77,7 +77,7 @@ def make_stub_analyze_xml(type): else: raise ValueError('Unknown type value') - def stub__analyze_xml(f): + def stub__analyze_xml(f, extra_schematron=None): return result, err return stub__analyze_xml diff --git a/scielomanager/validator/utils.py b/scielomanager/validator/utils.py index 4dea3cf4..db1fc357 100644 --- a/scielomanager/validator/utils.py +++ b/scielomanager/validator/utils.py @@ -41,13 +41,14 @@ def err_filter(err): return err_filter -def analyze_xml(file): +def analyze_xml(file, extra_schematron=None): """Analyzes `file` against packtools' XMLValidator. """ result = err = None try: - xml = packtools.XMLValidator.parse(file) + xml = packtools.XMLValidator.parse(file, + extra_schematron=extra_schematron) except (lxml.etree.XMLSyntaxError, IOError, ValueError, packtools.exceptions.XMLDoctypeError) as e: diff --git a/scielomanager/validator/views.py b/scielomanager/validator/views.py index faf6ea06..f0c8e6b7 100644 --- a/scielomanager/validator/views.py +++ b/scielomanager/validator/views.py @@ -24,7 +24,13 @@ def packtools_home(request, template_name='validator/stylechecker.html'): if form.is_valid(): xml_file = request.FILES['file'] - results, exc = utils.analyze_xml(xml_file) + if form.cleaned_data.get('add_scielo_br_rules', False): + extra_sch = packtools.catalogs.SCHEMAS['scielo-br'] + else: + extra_sch = None + + results, exc = utils.analyze_xml(xml_file, + extra_schematron=extra_sch) context['results'] = results context['xml_exception'] = getattr(exc, 'message', None) From dc0939099cd45aecc0a51a7b31eb4f67e93b4918 Mon Sep 17 00:00:00 2001 From: Gustavo Fonseca Date: Mon, 3 Oct 2016 17:56:08 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Adiciona=20os=20textos=20para=20tradu=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../locale/en_US/LC_MESSAGES/django.po | 27 ++++++++++-------- .../locale/es_ES/LC_MESSAGES/django.po | 28 +++++++++++-------- .../locale/pt_BR/LC_MESSAGES/django.po | 27 ++++++++++-------- 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/scielomanager/scielomanager/locale/en_US/LC_MESSAGES/django.po b/scielomanager/scielomanager/locale/en_US/LC_MESSAGES/django.po index 1bb8d8b3..77d68295 100644 --- a/scielomanager/scielomanager/locale/en_US/LC_MESSAGES/django.po +++ b/scielomanager/scielomanager/locale/en_US/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: SciELO Manager\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-24 15:07-0300\n" +"POT-Creation-Date: 2016-10-03 17:53-0300\n" "PO-Revision-Date: 2012-10-23 08:30+0000\n" "Last-Translator: scielo \n" "Language-Team: LANGUAGE \n" @@ -1057,13 +1057,11 @@ msgid "Journal cover image file size is too large! Please select another file." msgstr "" #: journalmanager/forms.py:198 -#, python-brace-format msgid "" "The image is {image_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" #: journalmanager/forms.py:204 -#, python-brace-format msgid "" "The image is {image_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1080,13 +1078,11 @@ msgid "Journal logo image file size is too large! Please select another file." msgstr "" #: journalmanager/forms.py:223 -#, python-brace-format msgid "" "The image is {logo_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" #: journalmanager/forms.py:227 -#, python-brace-format msgid "" "The image is {logo_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1605,7 +1601,6 @@ msgid "Can't delete, some issues are using this Section" msgstr "Cant't delete, some issues are using this Section" #: journalmanager/views.py:1210 -#, python-brace-format msgid "{journal} add to collection {collection}" msgstr "" @@ -2264,7 +2259,6 @@ msgid "Report" msgstr "Report bug" #: scielomanager/custom_fields.py:44 -#, python-brace-format msgid "Please keep file size under {maxsize}. Current file size {filesize}" msgstr "" @@ -2508,17 +2502,17 @@ msgstr "Please correct the errors below." msgid "You will receive an email with a link to activate your account." msgstr "You will receive an email with a link to activate your account." -#: validator/forms.py:9 +#: validator/forms.py:10 #: validator/templates/validator/includes/xml_annotated.html:15 msgid "File" msgstr "" -#: validator/forms.py:15 +#: validator/forms.py:16 #: validator/templates/validator/includes/xml_upload_form_validation.html:25 msgid "This type of file is not allowed! Please select another file." msgstr "" -#: validator/forms.py:18 +#: validator/forms.py:19 msgid "The file's size is too large! Please select a smaller file." msgstr "" @@ -2557,7 +2551,7 @@ msgid "Max. upload size" msgstr "" #: validator/templates/validator/preview_html.html:50 -#: validator/templates/validator/stylechecker.html:54 +#: validator/templates/validator/stylechecker.html:61 msgid "Clear" msgstr "" @@ -2566,7 +2560,7 @@ msgid "Preview" msgstr "" #: validator/templates/validator/preview_html.html:57 -#: validator/templates/validator/stylechecker.html:61 +#: validator/templates/validator/stylechecker.html:68 msgid "" "\n" " If you have any problems with the tool or with the SPS Tagging " @@ -2605,6 +2599,15 @@ msgid "" msgstr "" #: validator/templates/validator/stylechecker.html:55 +msgid "" +"\n" +" Also validate against SciELO Brazil's specific rules. Read more.\n" +" " +msgstr "" + +#: validator/templates/validator/stylechecker.html:62 msgid "Validate" msgstr "" diff --git a/scielomanager/scielomanager/locale/es_ES/LC_MESSAGES/django.po b/scielomanager/scielomanager/locale/es_ES/LC_MESSAGES/django.po index 5544afc4..605f2c77 100644 --- a/scielomanager/scielomanager/locale/es_ES/LC_MESSAGES/django.po +++ b/scielomanager/scielomanager/locale/es_ES/LC_MESSAGES/django.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: SciELO Manager\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-24 15:08-0300\n" +"POT-Creation-Date: 2016-10-03 17:53-0300\n" "PO-Revision-Date: 2016-07-22 11:49+0000\n" "Last-Translator: Javani Araujo \n" "Language-Team: Spanish (Spain) (http://www.transifex.com/scielo/" @@ -1027,7 +1027,6 @@ msgstr "" "favor seleccione otro archivo." #: journalmanager/forms.py:198 -#, python-brace-format msgid "" "The image is {image_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" @@ -1035,7 +1034,6 @@ msgstr "" "px" #: journalmanager/forms.py:204 -#, python-brace-format msgid "" "The image is {image_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1058,7 +1056,6 @@ msgstr "" "seleccione otro archivo." #: journalmanager/forms.py:223 -#, python-brace-format msgid "" "The image is {logo_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" @@ -1066,7 +1063,6 @@ msgstr "" "{expected_size}px" #: journalmanager/forms.py:227 -#, python-brace-format msgid "" "The image is {logo_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1571,7 +1567,6 @@ msgid "Can't delete, some issues are using this Section" msgstr "No se puede eliminar, algunas ediciones están usando esta Sección." #: journalmanager/views.py:1210 -#, python-brace-format msgid "{journal} add to collection {collection}" msgstr "{journal} agregado a la colección {collection}" @@ -2200,7 +2195,7 @@ msgid "Report" msgstr "Reporte" #: scielomanager/custom_fields.py:44 -#, fuzzy, python-brace-format +#, fuzzy msgid "Please keep file size under {maxsize}. Current file size {filesize}" msgstr "" "Por favor mantenga el tamaño de los archivos menores a %(maxsize)s. Tamaño " @@ -2447,18 +2442,18 @@ msgid "You will receive an email with a link to activate your account." msgstr "" "Usted recibirá un correo electrónico con un enlace para activar su cuenta." -#: validator/forms.py:9 +#: validator/forms.py:10 #: validator/templates/validator/includes/xml_annotated.html:15 msgid "File" msgstr "Archivo" -#: validator/forms.py:15 +#: validator/forms.py:16 #: validator/templates/validator/includes/xml_upload_form_validation.html:25 msgid "This type of file is not allowed! Please select another file." msgstr "" "Este tipo de archivo no está permitido! Por favor seleccione otro archivo." -#: validator/forms.py:18 +#: validator/forms.py:19 msgid "The file's size is too large! Please select a smaller file." msgstr "" "El tamaño de archivo es muy grande! Por favor seleccione otro archivo. " @@ -2499,7 +2494,7 @@ msgid "Max. upload size" msgstr "Tamaño máximo de archivos de subida" #: validator/templates/validator/preview_html.html:50 -#: validator/templates/validator/stylechecker.html:54 +#: validator/templates/validator/stylechecker.html:61 msgid "Clear" msgstr "Limpiar" @@ -2508,7 +2503,7 @@ msgid "Preview" msgstr "Vista previa" #: validator/templates/validator/preview_html.html:57 -#: validator/templates/validator/stylechecker.html:61 +#: validator/templates/validator/stylechecker.html:68 msgid "" "\n" " If you have any problems with the tool or with the SPS Tagging " @@ -2562,6 +2557,15 @@ msgstr "" " " #: validator/templates/validator/stylechecker.html:55 +msgid "" +"\n" +" Also validate against SciELO Brazil's specific rules. Read more.\n" +" " +msgstr "" + +#: validator/templates/validator/stylechecker.html:62 msgid "Validate" msgstr "Validar" diff --git a/scielomanager/scielomanager/locale/pt_BR/LC_MESSAGES/django.po b/scielomanager/scielomanager/locale/pt_BR/LC_MESSAGES/django.po index b2b873ed..7282c526 100644 --- a/scielomanager/scielomanager/locale/pt_BR/LC_MESSAGES/django.po +++ b/scielomanager/scielomanager/locale/pt_BR/LC_MESSAGES/django.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: SciELO Manager\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-08-24 15:08-0300\n" +"POT-Creation-Date: 2016-10-03 17:53-0300\n" "PO-Revision-Date: 2015-08-21 21:19+0000\n" "Last-Translator: Gustavo Fonseca \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/scielo/" @@ -985,13 +985,11 @@ msgid "Journal cover image file size is too large! Please select another file." msgstr "" #: journalmanager/forms.py:198 -#, python-brace-format msgid "" "The image is {image_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" #: journalmanager/forms.py:204 -#, python-brace-format msgid "" "The image is {image_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1008,13 +1006,11 @@ msgid "Journal logo image file size is too large! Please select another file." msgstr "" #: journalmanager/forms.py:223 -#, python-brace-format msgid "" "The image is {logo_size}px pixel wide. It's supposed to be {expected_size}px" msgstr "" #: journalmanager/forms.py:227 -#, python-brace-format msgid "" "The image is {logo_size}px pixel high. It's supposed to be {expected_size}px" msgstr "" @@ -1508,7 +1504,6 @@ msgid "Can't delete, some issues are using this Section" msgstr "" #: journalmanager/views.py:1210 -#, python-brace-format msgid "{journal} add to collection {collection}" msgstr "" @@ -2131,7 +2126,6 @@ msgid "Report" msgstr "Relatório" #: scielomanager/custom_fields.py:44 -#, python-brace-format msgid "Please keep file size under {maxsize}. Current file size {filesize}" msgstr "" @@ -2372,17 +2366,17 @@ msgstr "Por favor, corrija os erros abaixo." msgid "You will receive an email with a link to activate your account." msgstr "Você receberá um e-mail com um link para ativar sua conta." -#: validator/forms.py:9 +#: validator/forms.py:10 #: validator/templates/validator/includes/xml_annotated.html:15 msgid "File" msgstr "Arquivo" -#: validator/forms.py:15 +#: validator/forms.py:16 #: validator/templates/validator/includes/xml_upload_form_validation.html:25 msgid "This type of file is not allowed! Please select another file." msgstr "Tipo de arquivo não suportado. Por favor, selecione outro arquivo." -#: validator/forms.py:18 +#: validator/forms.py:19 msgid "The file's size is too large! Please select a smaller file." msgstr "Este arquivo é muito grande! Por favor, selecione um arquivo menor." @@ -2425,7 +2419,7 @@ msgid "Max. upload size" msgstr "Tamanho máximo" #: validator/templates/validator/preview_html.html:50 -#: validator/templates/validator/stylechecker.html:54 +#: validator/templates/validator/stylechecker.html:61 msgid "Clear" msgstr "Limpar" @@ -2434,7 +2428,7 @@ msgid "Preview" msgstr "" #: validator/templates/validator/preview_html.html:57 -#: validator/templates/validator/stylechecker.html:61 +#: validator/templates/validator/stylechecker.html:68 msgid "" "\n" " If you have any problems with the tool or with the SPS Tagging " @@ -2489,6 +2483,15 @@ msgstr "" " " #: validator/templates/validator/stylechecker.html:55 +msgid "" +"\n" +" Also validate against SciELO Brazil's specific rules. Read more.\n" +" " +msgstr "" + +#: validator/templates/validator/stylechecker.html:62 msgid "Validate" msgstr "Validar"