Project

General

Profile

« Previous | Next » 

Revision 167

map: Use row's index instead of pkey as ID in XML output

View differences:

map
90 90
            
91 91
            in_db = sql.connect(in_db_config)
92 92
            in_pkeys = {}
93
            for row in sql.rows(db_xml.get(in_db, in_root_xml, in_pkeys,
94
                limit)):
95
                row_id, = row
96
                row_id = str(row_id)
93
            for row_idx, row in enumerate(sql.rows(db_xml.get(in_db,
94
                in_root_xml, in_pkeys, limit))):
95
                row_id = str(row_idx)
96
                pkey, = row
97 97
                for in_, out in mappings:
98 98
                    value = metadata_value(in_)
99 99
                    if value == None:
100 100
                        in_ = in_.cloneNode(True) # don't modify orig value!
101
                        xml_dom.set_id(xpath.get(in_, in_root), row_id)
101
                        xml_dom.set_id(xpath.get(in_, in_root), pkey)
102 102
                        value = sql.value_or_none(db_xml.get(in_db, in_,
103 103
                            in_pkeys))
104 104
                    if value != None:

Also available in: Unified diff