URLOption: allow uppercase in resource name

This commit is contained in:
Emmanuel Garette 2015-04-19 09:46:39 +02:00
parent 2c6275ffbd
commit 072246a203
5 changed files with 40 additions and 37 deletions

View file

@ -3,6 +3,7 @@ Sun Apr 19 09:14:21 2015 +0200 Emmanuel Garette <egarette@cadoles.com>
* difference between option/optiondescription in PropertiesOptionError * difference between option/optiondescription in PropertiesOptionError
message message
* remove slave values when delete a master without value * 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 <egarette@cadoles.com> Sat Apr 18 22:42:53 2015 +0200 Emmanuel Garette <egarette@cadoles.com>
* refactor validation, build a fake context (with new Values and * refactor validation, build a fake context (with new Values and

View file

@ -158,3 +158,5 @@ def test_url():
c.u = 'https://foo.com:8443/' c.u = 'https://foo.com:8443/'
c.u = 'https://foo.com:8443/index.html' c.u = 'https://foo.com:8443/index.html'
raises(ValueError, "c.u = 'https://foo.com:84438989'") raises(ValueError, "c.u = 'https://foo.com:84438989'")
c.u = 'https://foo.com:8443/INDEX'
raises(ValueError, "c.u = 'https://FOO.COM:8443'")

View file

@ -506,7 +506,7 @@ class EmailOption(DomainnameOption):
class URLOption(DomainnameOption): class URLOption(DomainnameOption):
__slots__ = tuple() __slots__ = tuple()
proto_re = re.compile(r'(http|https)://') 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): def _validate(self, value, context=undefined):
self._impl_valid_unicode(value) self._impl_valid_unicode(value)
@ -538,7 +538,7 @@ class URLOption(DomainnameOption):
super(URLOption, self)._second_level_validation(domain, False) super(URLOption, self)._second_level_validation(domain, False)
# validate file # validate file
if files is not None and files != '' and not self.path_re.search(files): 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): def _second_level_validation(self, value, warnings_only):
pass pass

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Tiramisu\n" "Project-Id-Version: Tiramisu\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: \n"
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n" "Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n" "Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
@ -30,7 +30,7 @@ msgid "unknown group_type: {0}"
msgstr "group_type inconnu: {0}" msgstr "group_type inconnu: {0}"
#: tiramisu/config.py:181 tiramisu/setting.py:323 tiramisu/value.py:54 #: 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" msgid "the context does not exist anymore"
msgstr "le context n'existe plus" 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" msgstr "URL invalide, port doit être entre 0 et 65536"
#: tiramisu/option/option.py:541 #: tiramisu/option/option.py:541
msgid "invalid url, must ends with filename" msgid "invalid url, must ends with a valid resource name"
msgstr "URL invalide, doit finir avec un nom de fichier" msgstr "URL invalide, doit finir par un nom de ressource valide"
#: tiramisu/option/option.py:556 #: tiramisu/option/option.py:556
msgid "invalid username" 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" msgid "permissive must be a tuple"
msgstr "permissive doit être un 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}" msgid "invalid generic owner {0}"
msgstr "invalide owner générique {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}" msgstr "la valeur default_multi est invalide {0} pour l'option {1} : {2}"
#: tiramisu/storage/dictionary/option.py:138 #: 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}" msgid "information's item not found: {0}"
msgstr "aucune config spécifiée alors que c'est nécessaire" 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" msgid "optiondescription has no value"
msgstr "une optiondescription n'a pas de valeur" msgstr "une optiondescription n'a pas de valeur"
#: tiramisu/value.py:334 #: tiramisu/value.py:337
msgid "you should only set value with config" msgid "you should only set value with config"
msgstr "vous devez seul affecter une valeur avec un 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" msgid "owner only avalaible for an option"
msgstr "owner seulement possible pour une 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}" msgid "no value for {0} cannot change owner to {1}"
msgstr "pas de valeur pour {0} ne peut changer d'utilisateur pour {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" msgid "can force cache only if cache is actived in config"
msgstr "" msgstr ""
"peut force la mise en cache seulement si le cache est activé dans la config" "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 " msgid "{0} is already a Multi "
msgstr "{0} est déjà une 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" 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" 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" 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" 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" msgid "cmp is not permitted in python v3 or greater"
msgstr "cmp n'est pas permis en python v3 ou supérieure" 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" 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" 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" 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" 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" 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" 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" 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" msgstr "ne peut supprimer une valeur dans l'option multi {0} qui est esclave"

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -28,7 +28,7 @@ msgid "unknown group_type: {0}"
msgstr "" msgstr ""
#: tiramisu/config.py:181 tiramisu/setting.py:323 tiramisu/value.py:54 #: 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" msgid "the context does not exist anymore"
msgstr "" msgstr ""
@ -514,7 +514,7 @@ msgid "invalid url, port must be an between 0 and 65536"
msgstr "" msgstr ""
#: tiramisu/option/option.py:541 #: tiramisu/option/option.py:541
msgid "invalid url, must ends with filename" msgid "invalid url, must ends with a valid resource name"
msgstr "" msgstr ""
#: tiramisu/option/option.py:556 #: tiramisu/option/option.py:556
@ -609,7 +609,7 @@ msgstr ""
msgid "permissive must be a tuple" msgid "permissive must be a tuple"
msgstr "" msgstr ""
#: tiramisu/setting.py:516 tiramisu/value.py:442 #: tiramisu/setting.py:516 tiramisu/value.py:445
msgid "invalid generic owner {0}" msgid "invalid generic owner {0}"
msgstr "" msgstr ""
@ -642,7 +642,7 @@ msgid "invalid default_multi value {0} for option {1}: {2}"
msgstr "" msgstr ""
#: tiramisu/storage/dictionary/option.py:138 #: 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}" msgid "information's item not found: {0}"
msgstr "" msgstr ""
@ -691,51 +691,51 @@ msgstr ""
msgid "optiondescription has no value" msgid "optiondescription has no value"
msgstr "" msgstr ""
#: tiramisu/value.py:334 #: tiramisu/value.py:337
msgid "you should only set value with config" msgid "you should only set value with config"
msgstr "" msgstr ""
#: tiramisu/value.py:411 #: tiramisu/value.py:414
msgid "owner only avalaible for an option" msgid "owner only avalaible for an option"
msgstr "" msgstr ""
#: tiramisu/value.py:449 #: tiramisu/value.py:452
msgid "no value for {0} cannot change owner to {1}" msgid "no value for {0} cannot change owner to {1}"
msgstr "" msgstr ""
#: tiramisu/value.py:547 #: tiramisu/value.py:550
msgid "can force cache only if cache is actived in config" msgid "can force cache only if cache is actived in config"
msgstr "" msgstr ""
#: tiramisu/value.py:586 #: tiramisu/value.py:589
msgid "{0} is already a Multi " msgid "{0} is already a Multi "
msgstr "" msgstr ""
#: tiramisu/value.py:656 #: tiramisu/value.py:659
msgid "cannot append a value on a multi option {0} which is a slave" msgid "cannot append a value on a multi option {0} which is a slave"
msgstr "" msgstr ""
#: tiramisu/value.py:680 #: tiramisu/value.py:683
msgid "cannot sort multi option {0} if master or slave" msgid "cannot sort multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:684 #: tiramisu/value.py:687
msgid "cmp is not permitted in python v3 or greater" msgid "cmp is not permitted in python v3 or greater"
msgstr "" msgstr ""
#: tiramisu/value.py:693 #: tiramisu/value.py:696
msgid "cannot reverse multi option {0} if master or slave" msgid "cannot reverse multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:701 #: tiramisu/value.py:704
msgid "cannot insert multi option {0} if master or slave" msgid "cannot insert multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:714 #: tiramisu/value.py:717
msgid "cannot extend multi option {0} if master or slave" msgid "cannot extend multi option {0} if master or slave"
msgstr "" msgstr ""
#: tiramisu/value.py:746 #: tiramisu/value.py:749
msgid "cannot pop a value on a multi option {0} which is a slave" msgid "cannot pop a value on a multi option {0} which is a slave"
msgstr "" msgstr ""