author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Wed, 02 Sep 2015 15:31:18 +0200 | |
changeset 10634 | 06a43f727601 |
parent 10280 | 2cdab5e33542 |
child 10320 | facbb38c4c1a |
permissions | -rw-r--r-- |
9375
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
1 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5273
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6491
diff
changeset
|
18 |
"""Exceptions shared by different cubicweb packages.""" |
0 | 19 |
|
20 |
__docformat__ = "restructuredtext en" |
|
21 |
||
9375
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
22 |
from warnings import warn |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
23 |
|
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
24 |
from logilab.common.decorators import cachedproperty |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
25 |
|
10280
2cdab5e33542
[i18n] properly translate error messages related to violated unicity constraint.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9543
diff
changeset
|
26 |
from yams import ValidationError |
0 | 27 |
|
28 |
# abstract exceptions ######################################################### |
|
29 |
||
30 |
class CubicWebException(Exception): |
|
31 |
"""base class for cubicweb server exception""" |
|
32 |
msg = "" |
|
33 |
def __str__(self): |
|
34 |
if self.msg: |
|
35 |
if self.args: |
|
36 |
return self.msg % tuple(self.args) |
|
8265
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
37 |
else: |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
38 |
return self.msg |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
39 |
else: |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
40 |
return u' '.join(unicode(arg) for arg in self.args) |
0 | 41 |
|
42 |
class ConfigurationError(CubicWebException): |
|
43 |
"""a misconfiguration error""" |
|
44 |
||
45 |
class InternalError(CubicWebException): |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
46 |
"""base class for exceptions which should not occurs""" |
0 | 47 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
48 |
class SecurityError(CubicWebException): |
0 | 49 |
"""base class for cubicweb server security exception""" |
50 |
||
51 |
class RepositoryError(CubicWebException): |
|
52 |
"""base class for repository exceptions""" |
|
53 |
||
54 |
class SourceException(CubicWebException): |
|
55 |
"""base class for source exceptions""" |
|
56 |
||
57 |
class CubicWebRuntimeError(CubicWebException): |
|
58 |
"""base class for runtime exceptions""" |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
59 |
|
0 | 60 |
# repository exceptions ####################################################### |
61 |
||
62 |
class ConnectionError(RepositoryError): |
|
63 |
"""raised when a bad connection id is given or when an attempt to establish |
|
5032 | 64 |
a connection failed |
65 |
""" |
|
0 | 66 |
|
67 |
class AuthenticationError(ConnectionError): |
|
9175
a7412e884d7b
fix typos in docstring, doc and comments
Julien Cristau <julien.cristau@logilab.fr>
parents:
8695
diff
changeset
|
68 |
"""raised when an attempt to establish a connection failed due to wrong |
5032 | 69 |
connection information (login / password or other authentication token) |
4911
898c35be5873
#750055: make it easier to change post logout url
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4270
diff
changeset
|
70 |
""" |
0 | 71 |
|
72 |
class BadConnectionId(ConnectionError): |
|
5032 | 73 |
"""raised when a bad connection id is given""" |
0 | 74 |
|
75 |
class UnknownEid(RepositoryError): |
|
76 |
"""the eid is not defined in the system tables""" |
|
77 |
msg = 'No entity with eid %s in the repository' |
|
78 |
||
6211
e9d125fd1465
nicer error reporting for unique together constraints
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5426
diff
changeset
|
79 |
class UniqueTogetherError(RepositoryError): |
e9d125fd1465
nicer error reporting for unique together constraints
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
5426
diff
changeset
|
80 |
"""raised when a unique_together constraint caused an IntegrityError""" |
9375
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
81 |
def __init__(self, session, **kwargs): |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
82 |
self.session = session |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
83 |
assert 'rtypes' in kwargs or 'cstrname' in kwargs |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
84 |
self.kwargs = kwargs |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
85 |
|
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
86 |
@cachedproperty |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
87 |
def rtypes(self): |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
88 |
if 'rtypes' in self.kwargs: |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
89 |
return self.kwargs['rtypes'] |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
90 |
cstrname = unicode(self.kwargs['cstrname']) |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
91 |
cstr = self.session.find('CWUniqueTogetherConstraint', name=cstrname).one() |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
92 |
return sorted(rtype.name for rtype in cstr.relations) |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
93 |
|
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
94 |
@cachedproperty |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
95 |
def args(self): |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
96 |
warn('[3.18] UniqueTogetherError.args is deprecated, just use ' |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
97 |
'the .rtypes accessor.', |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
98 |
DeprecationWarning) |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
99 |
# the first argument, etype, is never used and was never garanteed anyway |
8e88576787c3
[schema] fix unique together index handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
9347
diff
changeset
|
100 |
return None, self.rtypes |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
101 |
|
8265
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
102 |
|
0 | 103 |
# security exceptions ######################################################### |
104 |
||
105 |
class Unauthorized(SecurityError): |
|
106 |
"""raised when a user tries to perform an action without sufficient |
|
107 |
credentials |
|
108 |
""" |
|
109 |
msg = 'You are not allowed to perform this operation' |
|
110 |
msg1 = 'You are not allowed to perform %s operation on %s' |
|
111 |
var = None |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
112 |
|
0 | 113 |
def __str__(self): |
114 |
try: |
|
115 |
if self.args and len(self.args) == 2: |
|
116 |
return self.msg1 % self.args |
|
117 |
if self.args: |
|
118 |
return ' '.join(self.args) |
|
119 |
return self.msg |
|
8695
358d8bed9626
[toward-py3k] rewrite to "except AnException as exc:" (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
8609
diff
changeset
|
120 |
except Exception as ex: |
0 | 121 |
return str(ex) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
122 |
|
8602
d066ba3bb07d
[web] add a Forbidden exception
David Douard <david.douard@logilab.fr>
parents:
8265
diff
changeset
|
123 |
class Forbidden(SecurityError): |
d066ba3bb07d
[web] add a Forbidden exception
David Douard <david.douard@logilab.fr>
parents:
8265
diff
changeset
|
124 |
"""raised when a user tries to perform a forbidden action |
d066ba3bb07d
[web] add a Forbidden exception
David Douard <david.douard@logilab.fr>
parents:
8265
diff
changeset
|
125 |
""" |
d066ba3bb07d
[web] add a Forbidden exception
David Douard <david.douard@logilab.fr>
parents:
8265
diff
changeset
|
126 |
|
0 | 127 |
# source exceptions ########################################################### |
128 |
||
129 |
class EidNotInSource(SourceException): |
|
130 |
"""trying to access an object with a particular eid from a particular |
|
131 |
source has failed |
|
132 |
""" |
|
133 |
msg = 'No entity with eid %s in %s' |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
134 |
|
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
135 |
|
0 | 136 |
# registry exceptions ######################################################### |
137 |
||
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6491
diff
changeset
|
138 |
# pre 3.15 bw compat |
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6491
diff
changeset
|
139 |
from logilab.common.registry import RegistryException, ObjectNotFound, NoSelectableObject |
0 | 140 |
|
141 |
class UnknownProperty(RegistryException): |
|
142 |
"""property found in database but unknown in registry""" |
|
143 |
||
144 |
# query exception ############################################################# |
|
145 |
||
146 |
class QueryError(CubicWebRuntimeError): |
|
147 |
"""a query try to do something it shouldn't""" |
|
148 |
||
149 |
class NotAnEntity(CubicWebRuntimeError): |
|
150 |
"""raised when get_entity is called for a column which doesn't contain |
|
151 |
a non final entity |
|
152 |
""" |
|
153 |
||
9347
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
154 |
class MultipleResultsError(CubicWebRuntimeError): |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
155 |
"""raised when ResultSet.one() is called on a resultset with multiple rows |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
156 |
of multiple columns. |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
157 |
""" |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
158 |
|
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
159 |
class NoResultError(CubicWebRuntimeError): |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
160 |
"""raised when no result is found but at least one is expected. |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
161 |
""" |
bd841d6ae723
[rset] New method: ResultSet.one()
Christophe de Vienne <cdevienne@gmail.com>
parents:
9175
diff
changeset
|
162 |
|
8265
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
163 |
class UndoTransactionException(QueryError): |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
164 |
"""Raised when undoing a transaction could not be performed completely. |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
165 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
166 |
Note that : |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
167 |
1) the partial undo operation might be acceptable |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
168 |
depending upon the final application |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
169 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
170 |
2) the undo operation can also fail with a `ValidationError` in |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
171 |
cases where the undoing breaks integrity constraints checked |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
172 |
immediately. |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
173 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
174 |
3) It might be that neither of those exception is raised but a |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
175 |
subsequent `commit` might raise a `ValidationError` in cases |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
176 |
where the undoing breaks integrity constraints checked at |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
177 |
commit time. |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
178 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
179 |
:type txuuix: int |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
180 |
:param txuuid: Unique identifier of the partialy undone transaction |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
181 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
182 |
:type errors: list |
9517
3338b2205ea3
Typo in comments and error messages
Dimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
parents:
9375
diff
changeset
|
183 |
:param errors: List of errors occurred during undoing |
8265
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
184 |
""" |
9517
3338b2205ea3
Typo in comments and error messages
Dimitri Papadopoulos <dimitri.papadopoulos@cea.fr>
parents:
9375
diff
changeset
|
185 |
msg = u"The following error(s) occurred while undoing transaction #%d : %s" |
8265
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
186 |
|
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
187 |
def __init__(self, txuuid, errors): |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
188 |
super(UndoTransactionException, self).__init__(txuuid, errors) |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
189 |
self.txuuid = txuuid |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
190 |
self.errors = errors |
9747ab9230ad
[repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents:
8190
diff
changeset
|
191 |
|
0 | 192 |
# tools exceptions ############################################################ |
193 |
||
194 |
class ExecutionError(Exception): |
|
195 |
"""server execution control error (already started, not running...)""" |
|
196 |
||
6491
ee9a10b6620e
pylint option update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6347
diff
changeset
|
197 |
# pylint: disable=W0611 |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1155
diff
changeset
|
198 |
from logilab.common.clcommands import BadCommandUsage |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6491
diff
changeset
|
199 |