From 072246a20348d1e3a6c0307afef9f059ede2f2d8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 19 Apr 2015 09:46:39 +0200 Subject: [PATCH] URLOption: allow uppercase in resource name --- ChangeLog | 1 + test/test_config_domain.py | 2 ++ tiramisu/option/option.py | 4 ++-- translations/fr/tiramisu.po | 36 ++++++++++++++++++------------------ translations/tiramisu.pot | 34 +++++++++++++++++----------------- 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 180268f..f52827a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Sun Apr 19 09:14:21 2015 +0200 Emmanuel Garette * difference between option/optiondescription in PropertiesOptionError message * remove slave values when delete a master without value + * allow uppercase in resource name in URLOption Sat Apr 18 22:42:53 2015 +0200 Emmanuel Garette * refactor validation, build a fake context (with new Values and diff --git a/test/test_config_domain.py b/test/test_config_domain.py index d31ebe5..30b9e00 100644 --- a/test/test_config_domain.py +++ b/test/test_config_domain.py @@ -158,3 +158,5 @@ def test_url(): c.u = 'https://foo.com:8443/' c.u = 'https://foo.com:8443/index.html' raises(ValueError, "c.u = 'https://foo.com:84438989'") + c.u = 'https://foo.com:8443/INDEX' + raises(ValueError, "c.u = 'https://FOO.COM:8443'") diff --git a/tiramisu/option/option.py b/tiramisu/option/option.py index 75b419e..554f1f9 100644 --- a/tiramisu/option/option.py +++ b/tiramisu/option/option.py @@ -506,7 +506,7 @@ class EmailOption(DomainnameOption): class URLOption(DomainnameOption): __slots__ = tuple() proto_re = re.compile(r'(http|https)://') - path_re = re.compile(r"^[a-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]+$") + path_re = re.compile(r"^[A-Za-z0-9\-\._~:/\?#\[\]@!%\$&\'\(\)\*\+,;=]+$") def _validate(self, value, context=undefined): self._impl_valid_unicode(value) @@ -538,7 +538,7 @@ class URLOption(DomainnameOption): super(URLOption, self)._second_level_validation(domain, False) # validate file if files is not None and files != '' and not self.path_re.search(files): - raise ValueError(_('invalid url, must ends with filename')) # pragma: optional cover + raise ValueError(_('invalid url, must ends with a valid resource name')) # pragma: optional cover def _second_level_validation(self, value, warnings_only): pass diff --git a/translations/fr/tiramisu.po b/translations/fr/tiramisu.po index 1230f74..9b1852c 100644 --- a/translations/fr/tiramisu.po +++ b/translations/fr/tiramisu.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Tiramisu\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-04-19 09:23+CEST\n" +"POT-Creation-Date: 2015-04-19 09:44+CEST\n" "PO-Revision-Date: \n" "Last-Translator: Emmanuel Garette \n" "Language-Team: Tiramisu's team \n" @@ -30,7 +30,7 @@ msgid "unknown group_type: {0}" msgstr "group_type inconnu: {0}" #: tiramisu/config.py:181 tiramisu/setting.py:323 tiramisu/value.py:54 -#: tiramisu/value.py:621 +#: tiramisu/value.py:624 msgid "the context does not exist anymore" msgstr "le context n'existe plus" @@ -568,8 +568,8 @@ msgid "invalid url, port must be an between 0 and 65536" msgstr "URL invalide, port doit être entre 0 et 65536" #: tiramisu/option/option.py:541 -msgid "invalid url, must ends with filename" -msgstr "URL invalide, doit finir avec un nom de fichier" +msgid "invalid url, must ends with a valid resource name" +msgstr "URL invalide, doit finir par un nom de ressource valide" #: tiramisu/option/option.py:556 msgid "invalid username" @@ -668,7 +668,7 @@ msgstr "tentative d'accès à une {0} nommée : {1} avec les propriétés {2}" msgid "permissive must be a tuple" msgstr "permissive doit être un tuple" -#: tiramisu/setting.py:516 tiramisu/value.py:442 +#: tiramisu/setting.py:516 tiramisu/value.py:445 msgid "invalid generic owner {0}" msgstr "invalide owner générique {0}" @@ -705,7 +705,7 @@ msgid "invalid default_multi value {0} for option {1}: {2}" msgstr "la valeur default_multi est invalide {0} pour l'option {1} : {2}" #: tiramisu/storage/dictionary/option.py:138 -#: tiramisu/storage/sqlalchemy/option.py:431 tiramisu/value.py:506 +#: tiramisu/storage/sqlalchemy/option.py:431 tiramisu/value.py:509 msgid "information's item not found: {0}" msgstr "aucune config spécifiée alors que c'est nécessaire" @@ -755,52 +755,52 @@ msgstr "un espace de stockage dictionary ne peut être persistant" msgid "optiondescription has no value" msgstr "une optiondescription n'a pas de valeur" -#: tiramisu/value.py:334 +#: tiramisu/value.py:337 msgid "you should only set value with config" msgstr "vous devez seul affecter une valeur avec un config" -#: tiramisu/value.py:411 +#: tiramisu/value.py:414 msgid "owner only avalaible for an option" msgstr "owner seulement possible pour une option" -#: tiramisu/value.py:449 +#: tiramisu/value.py:452 msgid "no value for {0} cannot change owner to {1}" msgstr "pas de valeur pour {0} ne peut changer d'utilisateur pour {1}" -#: tiramisu/value.py:547 +#: tiramisu/value.py:550 msgid "can force cache only if cache is actived in config" msgstr "" "peut force la mise en cache seulement si le cache est activé dans la config" -#: tiramisu/value.py:586 +#: tiramisu/value.py:589 msgid "{0} is already a Multi " msgstr "{0} est déjà une Multi" -#: tiramisu/value.py:656 +#: tiramisu/value.py:659 msgid "cannot append a value on a multi option {0} which is a slave" msgstr "ne peut ajouter une valeur sur l'option multi {0} qui est une esclave" -#: tiramisu/value.py:680 +#: tiramisu/value.py:683 msgid "cannot sort multi option {0} if master or slave" msgstr "ne peut trier une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:684 +#: tiramisu/value.py:687 msgid "cmp is not permitted in python v3 or greater" msgstr "cmp n'est pas permis en python v3 ou supérieure" -#: tiramisu/value.py:693 +#: tiramisu/value.py:696 msgid "cannot reverse multi option {0} if master or slave" msgstr "ne peut inverser une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:701 +#: tiramisu/value.py:704 msgid "cannot insert multi option {0} if master or slave" msgstr "ne peut insérer une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:714 +#: tiramisu/value.py:717 msgid "cannot extend multi option {0} if master or slave" msgstr "ne peut étendre une option multi {0} pour une maître ou une esclave" -#: tiramisu/value.py:746 +#: tiramisu/value.py:749 msgid "cannot pop a value on a multi option {0} which is a slave" msgstr "ne peut supprimer une valeur dans l'option multi {0} qui est esclave" diff --git a/translations/tiramisu.pot b/translations/tiramisu.pot index ae7b3e9..b3416e8 100644 --- a/translations/tiramisu.pot +++ b/translations/tiramisu.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2015-04-19 09:23+CEST\n" +"POT-Creation-Date: 2015-04-19 09:44+CEST\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -28,7 +28,7 @@ msgid "unknown group_type: {0}" msgstr "" #: tiramisu/config.py:181 tiramisu/setting.py:323 tiramisu/value.py:54 -#: tiramisu/value.py:621 +#: tiramisu/value.py:624 msgid "the context does not exist anymore" msgstr "" @@ -514,7 +514,7 @@ msgid "invalid url, port must be an between 0 and 65536" msgstr "" #: tiramisu/option/option.py:541 -msgid "invalid url, must ends with filename" +msgid "invalid url, must ends with a valid resource name" msgstr "" #: tiramisu/option/option.py:556 @@ -609,7 +609,7 @@ msgstr "" msgid "permissive must be a tuple" msgstr "" -#: tiramisu/setting.py:516 tiramisu/value.py:442 +#: tiramisu/setting.py:516 tiramisu/value.py:445 msgid "invalid generic owner {0}" msgstr "" @@ -642,7 +642,7 @@ msgid "invalid default_multi value {0} for option {1}: {2}" msgstr "" #: tiramisu/storage/dictionary/option.py:138 -#: tiramisu/storage/sqlalchemy/option.py:431 tiramisu/value.py:506 +#: tiramisu/storage/sqlalchemy/option.py:431 tiramisu/value.py:509 msgid "information's item not found: {0}" msgstr "" @@ -691,51 +691,51 @@ msgstr "" msgid "optiondescription has no value" msgstr "" -#: tiramisu/value.py:334 +#: tiramisu/value.py:337 msgid "you should only set value with config" msgstr "" -#: tiramisu/value.py:411 +#: tiramisu/value.py:414 msgid "owner only avalaible for an option" msgstr "" -#: tiramisu/value.py:449 +#: tiramisu/value.py:452 msgid "no value for {0} cannot change owner to {1}" msgstr "" -#: tiramisu/value.py:547 +#: tiramisu/value.py:550 msgid "can force cache only if cache is actived in config" msgstr "" -#: tiramisu/value.py:586 +#: tiramisu/value.py:589 msgid "{0} is already a Multi " msgstr "" -#: tiramisu/value.py:656 +#: tiramisu/value.py:659 msgid "cannot append a value on a multi option {0} which is a slave" msgstr "" -#: tiramisu/value.py:680 +#: tiramisu/value.py:683 msgid "cannot sort multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:684 +#: tiramisu/value.py:687 msgid "cmp is not permitted in python v3 or greater" msgstr "" -#: tiramisu/value.py:693 +#: tiramisu/value.py:696 msgid "cannot reverse multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:701 +#: tiramisu/value.py:704 msgid "cannot insert multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:714 +#: tiramisu/value.py:717 msgid "cannot extend multi option {0} if master or slave" msgstr "" -#: tiramisu/value.py:746 +#: tiramisu/value.py:749 msgid "cannot pop a value on a multi option {0} which is a slave" msgstr ""