annotate rhodecode/lib/exceptions.py @ 4147:1c8f818787b3 rhodecode-2.2.5-gpl

old style: show the full link box on summary page - no overlap or truncation
author Mads Kiilerich <madski@unity3d.com>
date Wed, 02 Jul 2014 19:03:23 -0400
parents ffd45b185016
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1307
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
1 # -*- coding: utf-8 -*-
1206
a671db5bdd58 fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
2 # This program is free software: you can redistribute it and/or modify
a671db5bdd58 fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
3 # it under the terms of the GNU General Public License as published by
a671db5bdd58 fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
4 # the Free Software Foundation, either version 3 of the License, or
a671db5bdd58 fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
5 # (at your option) any later version.
1203
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 902
diff changeset
6 #
704
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 # This program is distributed in the hope that it will be useful,
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 # GNU General Public License for more details.
1203
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 902
diff changeset
11 #
704
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 # You should have received a copy of the GNU General Public License
1206
a671db5bdd58 fixed license issue #149
Marcin Kuzminski <marcin@python-works.com>
parents: 1203
diff changeset
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
14 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
15 rhodecode.lib.exceptions
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
16 ~~~~~~~~~~~~~~~~~~~~~~~~
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
17
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
18 Set of custom exceptions used in RhodeCode
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
19
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
20 :created_on: Nov 17, 2010
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
21 :author: marcink
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
22 :copyright: (c) 2013 RhodeCode GmbH.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
23 :license: GPLv3, see LICENSE for more details.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4090
diff changeset
24 """
1307
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
25
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
26 from webob.exc import HTTPClientError
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
27
1307
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
28
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
29 class LdapUsernameError(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
30 pass
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
31
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
32
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
33 class LdapPasswordError(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
34 pass
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
35
704
26237de9b613 Added settings model, and Exceptions lib.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36
1307
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
37 class LdapConnectionError(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
38 pass
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
39
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
40
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
41 class LdapImportError(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
42 pass
713
1bb0fcdec895 fixed #72 show warning on removal when user still is owner of existing repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 704
diff changeset
43
1307
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
44
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
45 class DefaultUserException(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
46 pass
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
47
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
48
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
49 class UserOwnsReposException(Exception):
c1516b35f91d pep8ify
Marcin Kuzminski <marcin@python-works.com>
parents: 1206
diff changeset
50 pass
1435
a62af7d509ee fixes #228 - added detection of assigned groups to prevent errors on sqlite
Marcin Kuzminski <marcin@python-works.com>
parents: 1307
diff changeset
51
1824
89efedac4e6c 2012 copyrights
Marcin Kuzminski <marcin@python-works.com>
parents: 1532
diff changeset
52
3417
fa6ba6727475 further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents: 2726
diff changeset
53 class UserGroupsAssignedException(Exception):
1435
a62af7d509ee fixes #228 - added detection of assigned groups to prevent errors on sqlite
Marcin Kuzminski <marcin@python-works.com>
parents: 1307
diff changeset
54 pass
2677
4fbbc65e8cd5 Forbid changing changset status when it is associated with a closed pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
55
4fbbc65e8cd5 Forbid changing changset status when it is associated with a closed pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
56
4fbbc65e8cd5 Forbid changing changset status when it is associated with a closed pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 1824
diff changeset
57 class StatusChangeOnClosedPullRequestError(Exception):
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
58 pass
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
59
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
60
3641
b44979649915 recursive forks detach
Marcin Kuzminski <marcin@python-works.com>
parents: 3522
diff changeset
61 class AttachedForksError(Exception):
b44979649915 recursive forks detach
Marcin Kuzminski <marcin@python-works.com>
parents: 3522
diff changeset
62 pass
b44979649915 recursive forks detach
Marcin Kuzminski <marcin@python-works.com>
parents: 3522
diff changeset
63
b44979649915 recursive forks detach
Marcin Kuzminski <marcin@python-works.com>
parents: 3522
diff changeset
64
3788
d9b89874edf9 UserGroup on UserGroup permissions implementation.
Marcin Kuzminski <marcin@python-works.com>
parents: 3641
diff changeset
65 class RepoGroupAssignmentError(Exception):
d9b89874edf9 UserGroup on UserGroup permissions implementation.
Marcin Kuzminski <marcin@python-works.com>
parents: 3641
diff changeset
66 pass
d9b89874edf9 UserGroup on UserGroup permissions implementation.
Marcin Kuzminski <marcin@python-works.com>
parents: 3641
diff changeset
67
d9b89874edf9 UserGroup on UserGroup permissions implementation.
Marcin Kuzminski <marcin@python-works.com>
parents: 3641
diff changeset
68
3840
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3788
diff changeset
69 class NonRelativePathError(Exception):
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3788
diff changeset
70 pass
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3788
diff changeset
71
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3788
diff changeset
72
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
73 class HTTPLockedRC(HTTPClientError):
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
74 """
3522
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
75 Special Exception For locked Repos in RhodeCode, the return code can
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
76 be overwritten by _code keyword argument passed into constructors
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
77 """
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
78 code = 423
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
79 title = explanation = 'Repository Locked'
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
80
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
81 def __init__(self, reponame, username, *args, **kwargs):
3522
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
82 from rhodecode import CONFIG
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
83 from rhodecode.lib.utils2 import safe_int
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
84 _code = CONFIG.get('lock_ret_code')
7174ee850baa configurable locking codes.
Marcin Kuzminski <marcin@python-works.com>
parents: 3417
diff changeset
85 self.code = safe_int(_code, self.code)
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
86 self.title = self.explanation = ('Repository `%s` locked by '
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
87 'user `%s`' % (reponame, username))
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2677
diff changeset
88 super(HTTPLockedRC, self).__init__(*args, **kwargs)
4070
008e460c5b9d fixes issue #860.
Marcin Kuzminski <marcin@python-works.com>
parents: 3960
diff changeset
89
008e460c5b9d fixes issue #860.
Marcin Kuzminski <marcin@python-works.com>
parents: 3960
diff changeset
90
008e460c5b9d fixes issue #860.
Marcin Kuzminski <marcin@python-works.com>
parents: 3960
diff changeset
91 class IMCCommitError(Exception):
008e460c5b9d fixes issue #860.
Marcin Kuzminski <marcin@python-works.com>
parents: 3960
diff changeset
92 pass
4074
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
93
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
94
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
95 class UserCreationError(Exception):
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
96 pass
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
97
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
98
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
99 class RepositoryCreationError(Exception):
3b136af34329 Added pre-create user hook.
Marcin Kuzminski <marcin@python-works.com>
parents: 4070
diff changeset
100 pass
4090
7676606f7622 Added more detailed (and localized) information if hgsubversion is not
Grzegorz Rożniecki <xaerxess@gmail.com>
parents: 4074
diff changeset
101
7676606f7622 Added more detailed (and localized) information if hgsubversion is not
Grzegorz Rożniecki <xaerxess@gmail.com>
parents: 4074
diff changeset
102
7676606f7622 Added more detailed (and localized) information if hgsubversion is not
Grzegorz Rożniecki <xaerxess@gmail.com>
parents: 4074
diff changeset
103 class HgsubversionImportError(Exception):
7676606f7622 Added more detailed (and localized) information if hgsubversion is not
Grzegorz Rożniecki <xaerxess@gmail.com>
parents: 4074
diff changeset
104 pass