Unverified Commit bd4690d9 authored by mvdbeek's avatar mvdbeek
Browse files

Fix infinity value handling when serailzing tool form

Should fix https://github.com/galaxyproject/galaxy/issues/9576.
Seems like at some point in the past json.dumsp must've raised
a ValueError if you tried to serialize inf, but it doesn't anymore,
so the workaround in swap_inf_nan didn't work for inf.
parent e359db23
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -120,7 +120,10 @@ from galaxy.util.bunch import Bunch
from galaxy.util.dictifiable import Dictifiable
from galaxy.util.expressions import ExpressionContext
from galaxy.util.form_builder import SelectField
from galaxy.util.json import safe_loads
from galaxy.util.json import (
    safe_loads,
    swap_inf_nan,
)
from galaxy.util.rules_dsl import RuleSet
from galaxy.util.template import (
    fill_template,
@@ -2459,7 +2462,7 @@ class Tool(Dictifiable):
                "enctype": self.enctype,
            }
        )
        return tool_model
        return swap_inf_nan(tool_model)

    def populate_model(self, request_context, inputs, state_inputs, group_inputs, other_values=None):
        """
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ def safe_dumps(obj, **kwargs):
    """
    This is a wrapper around dumps that encodes Infinity and NaN values.  It's a
    fairly rare case (which will be low in request volume).  Basically, we tell
    json.dumps to blow up if it encounters Infinity/NaN, or Decimal values,
    json.dumps to blow up if it encounters Infinity/NaN, or Decimal values
    and we 'fix' it before re-encoding.
    """
    try: