Skip to content
Snippets Groups Projects
Commit 8b39746b authored by Axel Prel's avatar Axel Prel
Browse files

substitutions: use constants

parent 98cccb08
No related branches found
No related tags found
No related merge requests found
...@@ -141,5 +141,5 @@ ...@@ -141,5 +141,5 @@
def build_converter(self): def build_converter(self):
d = {} d = {}
for sub in self: for sub in self:
if sub.converter == "mail_template": if sub.converter == MAIL_TEMPLATE:
conv = converter.MailTemplate(sub.value, False) conv = converter.MailTemplate(sub.value, False)
...@@ -145,3 +145,3 @@ ...@@ -145,3 +145,3 @@
conv = converter.MailTemplate(sub.value, False) conv = converter.MailTemplate(sub.value, False)
elif sub.converter == "mail_template+deserialize": elif sub.converter == MAIL_TEMPLATE_DESERIALIZE:
conv = converter.MailTemplate(sub.value, True) conv = converter.MailTemplate(sub.value, True)
...@@ -147,3 +147,3 @@ ...@@ -147,3 +147,3 @@
conv = converter.MailTemplate(sub.value, True) conv = converter.MailTemplate(sub.value, True)
elif sub.converter == "constant": elif sub.converter == CONSTANT:
conv = converter.Constant(sub.value) conv = converter.Constant(sub.value)
...@@ -149,5 +149,5 @@ ...@@ -149,5 +149,5 @@
conv = converter.Constant(sub.value) conv = converter.Constant(sub.value)
elif sub.converter == "field": elif sub.converter == FIELD:
if "." in sub.value: if "." in sub.value:
path, name = sub.value.rsplit(".", 1) path, name = sub.value.rsplit(".", 1)
else: else:
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
conv = converter.Field(name) conv = converter.Field(name)
if path: if path:
conv = converter.relation(path.replace(".", "/"), conv) conv = converter.relation(path.replace(".", "/"), conv)
elif sub.converter == "image-file": elif sub.converter == IMAGE_FILE:
if "." in sub.value: if "." in sub.value:
path, name = sub.value.rsplit(".", 1) path, name = sub.value.rsplit(".", 1)
else: else:
...@@ -163,5 +163,5 @@ ...@@ -163,5 +163,5 @@
conv = converter.ImageFile(name) conv = converter.ImageFile(name)
if path: if path:
conv = converter.relation(path.replace(".", "/"), conv) conv = converter.relation(path.replace(".", "/"), conv)
elif sub.converter == "image-data-url": elif sub.converter == IMAGE_DATAURL:
conv = converter.ImageDataURL(sub.value) conv = converter.ImageDataURL(sub.value)
...@@ -167,5 +167,5 @@ ...@@ -167,5 +167,5 @@
conv = converter.ImageDataURL(sub.value) conv = converter.ImageDataURL(sub.value)
elif sub.converter == "relation-to-many": elif sub.converter == RELATION_2MANY:
# Unpack the result of finding a field with its sort order into # Unpack the result of finding a field with its sort order into
# variable names. # variable names.
value, sorted = parse_sorted_field(sub.value) value, sorted = parse_sorted_field(sub.value)
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
sortkey=sortkey(sorted) if sorted else None, sortkey=sortkey(sorted) if sorted else None,
converter=sub.get_children().build_converter(), converter=sub.get_children().build_converter(),
) )
elif sub.converter == "relation-path": elif sub.converter == RELATION_PATH:
conv = converter.relation( conv = converter.relation(
sub.value, sub.get_children().build_converter() sub.value, sub.get_children().build_converter()
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment