equal
deleted
inserted
replaced
105 cstr = self.session.find('CWUniqueTogetherConstraint', name=cstrname).one() |
105 cstr = self.session.find('CWUniqueTogetherConstraint', name=cstrname).one() |
106 return sorted(rtype.name for rtype in cstr.relations) |
106 return sorted(rtype.name for rtype in cstr.relations) |
107 |
107 |
108 |
108 |
109 class ViolatedConstraint(RepositoryError): |
109 class ViolatedConstraint(RepositoryError): |
110 def __init__(self, cnx, cstrname): |
110 def __init__(self, cnx, cstrname, query): |
111 self.cnx = cnx |
111 self.cnx = cnx |
112 self.cstrname = cstrname |
112 self.cstrname = cstrname |
|
113 message = ( |
|
114 "constraint '%s' is being violated by the query '%s'. " |
|
115 "You can run the inverted constraint on the database to list the problematic rows." |
|
116 ) % (cstrname, query) |
|
117 super(ViolatedConstraint, self).__init__(message) |
113 |
118 |
114 |
119 |
115 # security exceptions ######################################################### |
120 # security exceptions ######################################################### |
116 |
121 |
117 class Unauthorized(SecurityError): |
122 class Unauthorized(SecurityError): |