Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@odony
Created March 23, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odony/eb288b2308cef8d2e2c6a467eb4aded2 to your computer and use it in GitHub Desktop.
Save odony/eb288b2308cef8d2e2c6a467eb4aded2 to your computer and use it in GitHub Desktop.
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index f630eef..7794ff8 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -540,9 +540,8 @@ class Website(models.Model):
continue
values = [{}]
convitems = converters.items()
- # converters with a domain are processed after the other ones
- gd = lambda x: hasattr(x[1], 'domain') and (x[1].domain != '[]')
- convitems.sort(lambda x, y: cmp(gd(x), gd(y)))
+ # converters with a domain are processed after the other ones, but from left to right
+ convitems.sort(key=lambda x: (hasattr(x[1], 'domain') and (x[1].domain != '[]'), rule._trace.index((True,x[0]))))
for (i, (name, converter)) in enumerate(convitems):
newval = []
for val in values:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment