Skip to content

Commit

Permalink
Merge pull request #14 from Viagenie/release-3.0.0
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
jumpifnotzero authored Jan 4, 2021
2 parents 42faf6c + dc286c0 commit 6eedcaa
Show file tree
Hide file tree
Showing 98 changed files with 166,514 additions and 1,189 deletions.
30 changes: 30 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog for lgr-django

## 3.0.0 (2020-12-04)
### New features
- Add MSR-4 validating repertoire
- Add RZ-LGR validating repertoires
- Add RZ-LGR in built in LGRs list
- Allow collision tool to check collisions with existing set of TLDs downloaded from IANA
- Add a new basic mode:
- new simplified interface
- validate labels against RZ-LGR
- allow checking for collisions as well
- Add language autocompletion from IANA language registry
- Stop support for python 2.7
### Improvements
- Update symetry report to consider contextual rules
- Update Django to version 2.2.1
- Update dependencies versions
- Handle internationalized email addresses
- Add translation to validation report
- Cache scripts and repertoires
- Improve memory consumption
- Display IDNA error as user friendly strings
- Correctly validate rule in LGR edition tool
### Fixes
- Fix memory leak
- Fix error handling in label validation

## 2.0.1 (2019-08-01)
### Improvements
- Mark out-of-script codepoints as warnings instead of errors (Fixes icann/lgr-core#15).

## 2.0.0 (2018-09-06)
### New features
- Support of Python 3. Compatibility with python2 is preserved for this release.
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ MO_FILES= \
src/lgr_tools/locale/ar/LC_MESSAGES/django.mo \
src/lgr_tools/locale/en/LC_MESSAGES/django.mo \
src/lgr_tools/locale/fr/LC_MESSAGES/django.mo \
src/lgr_basic/locale/ar/LC_MESSAGES/django.mo \
src/lgr_basic/locale/en/LC_MESSAGES/django.mo \
src/lgr_basic/locale/fr/LC_MESSAGES/django.mo \


PO_FILES= \
src/lgr_web/locale/ar/LC_MESSAGES/django.po \
Expand All @@ -36,12 +40,16 @@ PO_FILES= \
src/lgr_tools/locale/ar/LC_MESSAGES/django.po \
src/lgr_tools/locale/en/LC_MESSAGES/django.po \
src/lgr_tools/locale/fr/LC_MESSAGES/django.po \
src/lgr_basic/locale/ar/LC_MESSAGES/django.po \
src/lgr_basic/locale/en/LC_MESSAGES/django.po \
src/lgr_basic/locale/fr/LC_MESSAGES/django.po \


all: messages

messages: $(MO_FILES)

update: update-lgrweb update-lgreditor update-lgrvalidator update-lgrtools
update: update-lgrweb update-lgreditor update-lgrvalidator update-lgrtools update-lgrbasic

update-lgrweb:
cd src/lgr_web && $(MAKEMESSAGES) $(LANGUAGES) $(MKMSG_OPTIONS)
Expand All @@ -55,6 +63,10 @@ update-lgrvalidator:
update-lgrtools:
cd src/lgr_tools && $(MAKEMESSAGES) $(LANGUAGES) $(MKMSG_OPTIONS)

update-lgrbasic:
cd src/lgr_basic && $(MAKEMESSAGES) $(LANGUAGES) $(MKMSG_OPTIONS)


src/lgr_web/locale/%/LC_MESSAGES/django.po:
cd `echo "$@" | sed -e 's#\/locale/.*##'` && django-admin.py makemessages $(LANGUAGES) $(MKMSG_OPTIONS)

Expand All @@ -67,5 +79,8 @@ src/lgr_validator/locale/%/LC_MESSAGES/django.po:
src/lgr_tools/locale/%/LC_MESSAGES/django.po:
cd `echo "$@" | sed -e 's#\/locale/.*##'` && django-admin.py makemessages $(LANGUAGES) $(MKMSG_OPTIONS)

src/lgr_basic/locale/%/LC_MESSAGES/django.po:
cd `echo "$@" | sed -e 's#\/locale/.*##'` && django-admin.py makemessages $(LANGUAGES) $(MKMSG_OPTIONS)

$(MO_FILES): $(PO_FILES)
cd `echo "$@" | sed -e 's#\/locale/.*##'` && $(COMPILEMESSAGES)
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ The following modules are reusable Django apps that can be included in other Dja
* `lgr_validator` contains the code related the label validation module.
* `lgr_tools` contains the code related to all utilities: testing LGR and label sets, LGR comparisons, etc.
* `lgr_renderer` contains the code and templates used to generate the static exports of the LGR (HTML only for now).
* `lgr_basic` contains the code related to the simple LGR interface.

## Acknowledgment

This toolset was implemented by Viagenie (Audric Schiltknecht, Julien Bernard,
David Drouin and Marc Blanchet) and Wil Tan on an ICANN contract.
David Drouin, Vincent Gonzalez and Marc Blanchet) and Wil Tan on an ICANN contract.

## License

Expand Down Expand Up @@ -53,7 +54,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
### Pre-requisites

* Operating system: Tested on Linux and Mac OS X
* Python 2.7, >= 3.4
* Python >=3.6
* [LibXML2](http://www.xmlsoft.org/) [MIT License] used by the lxml Python bindings
* [ICU4C](http://site.icu-project.org/) [ICU License]
* Python modules (listed in `etc/requirements.txt`, or dependencies thereof)
Expand Down Expand Up @@ -183,6 +184,7 @@ Some notes for developers
* `src/lgr_validator/templates` contains validator-specific templates
* `src/lgr_tools/templates` contains tool-specific templates
* `src/lgr_renderer/templates` contains renderers (HTML output) templates
* `src/lgr_basic/templates` contains simple interface (HTML output) templates


#### Static Assets (CSS, Javascript, Images)
Expand Down
2 changes: 1 addition & 1 deletion bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DSITE="src/lgr_web"

if [ ! -e venv ]; then
echo "==> Creating virtualenv"
virtualenv venv || exit 3
virtualenv -p python3 venv || exit 3
fi

# activate virtualenv
Expand Down
19 changes: 11 additions & 8 deletions etc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Core stuff
Django==1.8.4
django-widget-tweaks==1.4.1
django-multiupload==0.5.2
celery[redis]==3.1.23
django-redis-cache==1.7.1
Django==2.2.1
django-widget-tweaks==1.4.3
#django-multiupload==0.5.2
-e git+https://github.com/Chive/django-multiupload.git@ba52e161a68ce19062c3655e89544c2d377990a0#egg=django-multiupload
celery[redis]==4.3.0
django-redis-cache==2.0.0
django-autocomplete-light==3.5.1
vine==1.3.0

# LGR/Unicode modules
picu==1.0
picu==1.1
munidata==2.0.0
lgr-core==2.0.0
lgr-core==3.0.0

# Natural sorting implementation
natsort==5.0.3
natsort==6.0.0
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='lgr-django',
version='2.0.0',
version='3.0.0',
author='Viagenie and Wil Tan',
author_email='[email protected]',
packages=find_packages('src'),
Expand All @@ -19,15 +19,18 @@
'Framework :: Django :: 1.8',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
install_requires=[
# Core stuff
'Django',
'django-widget-tweaks',
'django-multiupload',
'django-redis-cache',
'django-autocomplete-light',
'celery',
# LGR/Unicode modules
'lgr-core',
Expand Down
Empty file added src/lgr_basic/__init__.py
Empty file.
64 changes: 64 additions & 0 deletions src/lgr_basic/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _

from lgr.tools.utils import parse_label_input
from lgr_editor.api import LGRInfo
from lgr_editor.forms.fields import ROOT_ZONES
from lgr_editor.lgr_exceptions import lgr_exception_to_text
from lgr_editor.repertoires import get_by_name
from lgr_editor.unidb import get_db_by_version
from lgr_tools.forms import UAEmailField


class ValidateLabelSimpleForm(forms.Form):
rz_lgr = forms.ChoiceField(label='', required=True, choices=ROOT_ZONES, initial=ROOT_ZONES[-1][0])
labels = forms.CharField(label='', required=False,
widget=forms.TextInput(attrs={'name': '',
'class': 'form-label form-control',
'onkeyup': 'buttonValidateEnabled()',
'placeholder': _('Label')}))
labels_file = forms.FileField(label='', help_text=_('File must be encoded in UTF-8 and using UNIX line ending.'),
required=False)
email = UAEmailField(label='', required=False,
widget=forms.TextInput(attrs={'id': 'email-task',
'placeholder': _('Email address for tasks results')}),
help_text=_("As the computing may be very long, we will warn by e-mail once the result can "
"be downloaded."))
collisions = forms.BooleanField(label='', widget=forms.CheckboxInput(attrs={'id': 'check-for-collision'}),
required=False)

def clean(self):
cleaned_data = super(ValidateLabelSimpleForm, self).clean()
if (self.cleaned_data.get('collisions') and len(cleaned_data.get('labels', [])) > 1) or self.cleaned_data.get(
'labels_file'):
if not self.cleaned_data.get('email'):
self.add_error('email', _('E-mail is mandatory to get the tasks results'))

if 'labels' not in self.errors and not cleaned_data.get('labels') and not cleaned_data.get('labels_file'):
self.add_error('labels', _('Required'))
self.add_error('labels_file', _('Required'))

if cleaned_data.get('labels') and cleaned_data.get('labels_file'):
# should not happen
self.add_error('labels', _('Unknown error, please report'))
self.add_error('labels_file', _('Unknown error, please report'))

return cleaned_data

def clean_labels(self):
rz_lgr = self.cleaned_data['rz_lgr']
lgr_info = LGRInfo(rz_lgr, lgr=get_by_name(rz_lgr, with_unidb=True))
udata = get_db_by_version(lgr_info.lgr.metadata.unicode_version)

value = self.cleaned_data['labels']
labels = list()
for label in set(value.split(';')):
if not label:
continue
try:
labels.append(parse_label_input(label, idna_decoder=udata.idna_decode_label))
except ValueError as e:
raise ValidationError(lgr_exception_to_text(e))
return labels
Binary file added src/lgr_basic/locale/ar/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 6eedcaa

Please sign in to comment.