server/sources/native.py
branchstable
changeset 8821 c4aa23af0baa
parent 8707 28cbd267e96b
parent 8820 dbffb6959564
child 8900 010a59e12d89
child 8910 7652c3d46ba3
--- a/server/sources/native.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/sources/native.py	Thu Mar 28 12:32:26 2013 +0100
@@ -756,13 +756,17 @@
                     mo = re.search('unique_cw_[^ ]+_idx', arg)
                     if mo is not None:
                         index_name = mo.group(0)
-                        elements = index_name.rstrip('_idx').split('_cw_')[1:]
+                        # right-chop '_idx' postfix
+                        # (garanteed to be there, see regexp above)
+                        elements = index_name[:-4].split('_cw_')[1:]
                         etype = elements[0]
                         rtypes = elements[1:]
                         raise UniqueTogetherError(etype, rtypes)
                     mo = re.search('columns (.*) are not unique', arg)
                     if mo is not None: # sqlite in use
-                        rtypes = [c.strip().lstrip('cw_') for c in mo.group(1).split(',')]
+                        # we left chop the 'cw_' prefix of attribute names
+                        rtypes = [c.strip()[3:]
+                                  for c in mo.group(1).split(',')]
                         etype = '???'
                         raise UniqueTogetherError(etype, rtypes)
             raise