Projet

Général

Profil

0001-fix-non-determinism-when-importing-wscall-workflow-a.patch

Benjamin Dauvergne, 06 avril 2016 18:37

Télécharger (2,71 ko)

Voir les différences:

Subject: [PATCH] fix non determinism when importing wscall workflow actions
 (#10477)

 tests/test_workflow_import.py | 3 ++-
 wcs/wf/wscall.py              | 7 ++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
tests/test_workflow_import.py
2 2
import shutil
3 3
import StringIO
4 4
import xml.etree.ElementTree as ET
5
from collections import OrderedDict
5 6

  
6 7
from quixote import cleanup
7 8
from wcs import publisher
......
306 307
    wscall.varname = 'varname'
307 308
    wscall.post = False
308 309
    wscall.request_signature_key = 'key'
309
    wscall.post_data = {'one': '1', 'two': '=2', 'good:name': 'ok'}
310
    wscall.post_data = OrderedDict((('one', '1'), ('two', '=2'), ('good:name', 'ok')))
310 311
    st1.items.append(wscall)
311 312
    wscall.parent = st1
312 313

  
wcs/wf/wscall.py
20 20
import traceback
21 21
import xml.etree.ElementTree as ET
22 22

  
23
from collections import OrderedDict
23 24
from quixote.html import TemplateIO, htmltext
24 25
from qommon.errors import ConnectionError
25 26
from qommon.form import *
......
122 123
        if 'post_data' in parameters:
123 124
            form.add(WidgetDict, '%spost_data' % prefix,
124 125
                    title=_('Post data'),
125
                    value=self.post_data or {})
126
                    value=dict(self.post_data or {}))
126 127
        if 'varname' in parameters:
127 128
            form.add(VarnameWidget, '%svarname' % prefix,
128 129
                     title=_('Variable Name'), value=self.varname)
......
179 180

  
180 181
        # if self.post_data exists, post_data is a dict built from it
181 182
        if self.post_data:
182
            post_data = {}
183
            post_data = OrderedDict()
183 184
            for (key, value) in self.post_data.items():
184 185
                try:
185 186
                    post_data[key] = self.compute(value, raises=True)
......
311 312
    def post_data_init_with_xml(self, elem, charset, include_id=False):
312 313
        if elem is None:
313 314
            return
314
        self.post_data = {}
315
        self.post_data = OrderedDict()
315 316
        for item in elem.findall('item'):
316 317
            key = item.find('name').text.encode(charset)
317 318
            value = item.find('value').text.encode(charset)
318
-