id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release 11017,"If accidentally create a form with two input fields with the same ID, after first edit it fails to load the page",sylvix.dh@…,,"Hello. I'm using TracFormsPlugin r12970 with the following trac installation (only relevant information): || '''Trac''' || 1.0.1 || || '''Genshi''' || 0.7 (without speedups) || || '''pysqlite''' || 2.6.0 || || '''Python''' || 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] || || '''SQLite''' || 3.7.9 || I'm using the default sqlite database that trac offered me while creating environment. If I accidentally create a form with two fields with the same ID, after first edit it fails to open the page I added the form to, with the following error: {{{ AttributeError: 'list' object has no attribute 'replace' File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/templates/wiki_view.html"", line 49, in File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 1546, in format_to_html File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 1501, in generate File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 1244, in format File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 1134, in handle_code_block File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 356, in process File ""/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py"", line 343, in _macro_processor File ""/home/tsyganov/projects/trac-plugins/TracFormsPlugin/trunk/0.11/tracforms/macros.py"", line 48, in expand_macro File ""/home/tsyganov/projects/trac-plugins/TracFormsPlugin/trunk/0.11/tracforms/macros.py"", line 133, in execute File ""/home/tsyganov/projects/trac-plugins/TracFormsPlugin/trunk/0.11/tracforms/macros.py"", line 638, in _xml_escape }}} Here is the form I worked on (I only changed the labels). Two pairs of fields with the same ID are at the end: {{{ #! TracForm #! track_fields || Routine || Time, h || Result || || Label 1 || [tf.input:deployment.time.note '' 3] || [tf.input:deployment.result.note '' 5] || || Label 2 || [tf.input:deployment.time.adhoc '' 3] || [tf.input:deployment.result.adhoc '' 5] || || Label 3 || [tf.input:deployment.time.ship '' 3] || [tf.input:deployment.result.ship '' 5] || || Label 4 || [tf.input:deployment.time.test '' 3] || [tf.input:deployment.result.test '' 5] || || Label 5 || [tf.input:deployment.time.test '' 3] || [tf.input:deployment.result.test '' 5] || }}} So, the plugin saves the data of the same id as the list of values (here is the result of the selection with sqlite3): {{{ sqlite> select * from forms where realm = 'wiki'; 1|wiki|TestTracForms||{""deployment.time.note"":""1"",""deployment.result.note"":""blah"",""deployment.result.test"":[""afdsf"",""afdsf""],""deployment.result.adhoc"":""b"",""deployment.time.adhoc"":""2"",""deployment.result.ship"":""yip"",""deployment.time.ship"":""3"",""deployment.time.test"":[""5"",""5""]}|admin|1366001113|| }}} Here you can see the `""deployment.result.test"":[""afdsf"",""afdsf""]` and `""deployment.time.test"":[""5"",""5""]` values. As the quick fix, I added two following lines to the macros.py file at line 131: {{{ for name, value in json.loads(state or '{}').iteritems(): if isinstance(value, list): value = value[0] self.env[name] = _xml_escape(value) }}} Please tell me if I'm doing anything wrong or if the problem exists, if there is another way to prevent this from happening (disallow saving forms with same IDs or something like that). Thanks in advance, Dmitrii",defect,new,normal,TracFormsPlugin,normal,,invalid markup,,0.11