# HG changeset patch # User Aurelien Campeas # Date 1382020253 -7200 # Node ID eff262f5ec3f76054aff5ba6d33dc6f5307fab84 # Parent 9a44436cd5a5721e9a28459ae0ba92696f2487b8 [source/native] fix sqlserver pattern matcher for unique constraints (closes #3227593) The matcher is used to parse the low-level error message and extract meaningful information for the end users. If broken, the users see an alarming and bewildering message. A full & definitive fix is scheduled for CubicWeb 3.18. diff -r 9a44436cd5a5 -r eff262f5ec3f server/sources/native.py --- a/server/sources/native.py Thu Oct 17 10:30:35 2013 +0200 +++ b/server/sources/native.py Thu Oct 17 16:30:53 2013 +0200 @@ -757,8 +757,10 @@ if ex.__class__.__name__ == 'IntegrityError': # need string comparison because of various backends for arg in ex.args: - # postgres and sqlserver - mo = re.search('"unique_cw_[^ ]+"', arg) + if 'SQL Server' in arg: + mo = re.search("'unique_cw_[^ ]+'", arg) + else: # postgres + mo = re.search('"unique_cw_[^ ]+"', arg) if mo is not None: index_name = mo.group(0)[1:-1] # eat the surrounding " pair elements = index_name.split('_cw_')[1:]