From a8374d26b9ee59fb9ff62fcb2bd0e09618a38e4e Mon Sep 17 00:00:00 2001 From: "Dr. Frank Hoffmann" Date: Mon, 27 May 2019 21:10:01 +0200 Subject: [PATCH] fixed field sorting in email --- conf/zms3.formulator.metaobj.xml | 8 ++++---- setup.py | 2 +- zms3/formulator/ZMSFormulator.py | 30 +++++++++++++++++++----------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/conf/zms3.formulator.metaobj.xml b/conf/zms3.formulator.metaobj.xml index 30f78aa..414e38d 100644 --- a/conf/zms3.formulator.metaobj.xml +++ b/conf/zms3.formulator.metaobj.xml @@ -675,7 +675,7 @@ $ZMI.registerReady(function() { - + @@ -1214,7 +1214,7 @@ textarea.form-control.rawJSON { - + @@ -1246,7 +1246,7 @@ textarea.form-control.rawJSON { 0 - + @@ -1524,7 +1524,7 @@ def downloadData(self): - + diff --git a/setup.py b/setup.py index de67900..bd7dcdc 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ else: site_packages = get_python_lib() -VERSION = '3.4.15' +VERSION = '3.4.16' zmspkg_name = 'formulator' branch_name = 'master' diff --git a/zms3/formulator/ZMSFormulator.py b/zms3/formulator/ZMSFormulator.py index 468eb96..c5f517d 100644 --- a/zms3/formulator/ZMSFormulator.py +++ b/zms3/formulator/ZMSFormulator.py @@ -379,25 +379,33 @@ def printDataRaw(self, receivedData=None, frmt='txt'): if isinstance(receivedData, dict): data = receivedData - # Handle ZODB-Dictionary + # Handle ZODB-Dictionary and REQUEST-Data if isinstance(data, dict): if frmt=='txt': s = '%s entries:\n\n'%len(data) + # data values if len(data) > 0: - header.extend( [ i[0] for i in data[data.keys()[0]] ] ) - s += '#/#'.join(header).upper() +'\n' + s1 = '' + sorted_v = {} + for t, v in sorted(data.iteritems()): + output = [] + output.append(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t))) + sorted_v = sorted(v) + for i in sorted_v: + i1, i2 = i + outstr = self.this.str_item(i2) + outstr = outstr.replace('\n',', ') + output.append(_globals.html_quote(outstr)) + s1 += '#/#'.join(output) + '\n' - for t, v in sorted(data.iteritems()): - output = [] - output.append(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t))) + # data header + s0 = '' for i in sorted(v): i1, i2 = i - outstr = self.this.str_item(i2) - outstr = outstr.replace('\n',', ') - output.append(_globals.html_quote(outstr)) - s += '#/#'.join(output) + '\n' - + header.append(i1) + s0 += '#/#'.join(header).upper() +'\n' + s = s0 + s1 # Handle SQL-Storage else: