[FIX] Make sure the generated view is always the same and the order of the button does not change randomly
This commit is contained in:
parent
d7426b969a
commit
e0949fb9d2
|
|
@ -118,13 +118,17 @@ class ServerEnvMixin(models.AbstractModel):
|
||||||
current_env = self.env.context.get("environment") or config.get(
|
current_env = self.env.context.get("environment") or config.get(
|
||||||
"running_env"
|
"running_env"
|
||||||
)
|
)
|
||||||
other_environments = [
|
# Important to keep this list sorted. It makes sure the button to
|
||||||
|
# switch environment will always be in the same order. (more user
|
||||||
|
# friendly) and the test would fail without it as the order could
|
||||||
|
# change randomly and the view would then also change randomly
|
||||||
|
other_environments = sorted([
|
||||||
key[15:]
|
key[15:]
|
||||||
for key, val in config.options.items()
|
for key, val in config.options.items()
|
||||||
if key.startswith("encryption_key_")
|
if key.startswith("encryption_key_")
|
||||||
and val
|
and val
|
||||||
and key[15:] != current_env
|
and key[15:] != current_env
|
||||||
]
|
])
|
||||||
|
|
||||||
if not current_env:
|
if not current_env:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue