diff rhodecode/lib/exceptions.py @ 2726:aa17c7a1b8a5 beta

Implemented basic locking functionality. - Reimplemented how githooks behave - emaulate pre-receive hook - install missing git hooks if they aren't already in repo
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 22 Aug 2012 00:30:02 +0200
parents 4fbbc65e8cd5
children 63e58ef80ef1 fa6ba6727475
line wrap: on
line diff
--- a/rhodecode/lib/exceptions.py	Tue Aug 21 19:36:21 2012 +0200
+++ b/rhodecode/lib/exceptions.py	Wed Aug 22 00:30:02 2012 +0200
@@ -23,6 +23,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from webob.exc import HTTPClientError
+
 
 class LdapUsernameError(Exception):
     pass
@@ -53,4 +55,17 @@
 
 
 class StatusChangeOnClosedPullRequestError(Exception):
-    pass
\ No newline at end of file
+    pass
+
+
+class HTTPLockedRC(HTTPClientError):
+    """
+    Special Exception For locked Repos in RhodeCode
+    """
+    code = 423
+    title = explanation = 'Repository Locked'
+
+    def __init__(self, reponame, username, *args, **kwargs):
+        self.title = self.explanation = ('Repository `%s` locked by '
+                                         'user `%s`' % (reponame, username))
+        super(HTTPLockedRC, self).__init__(*args, **kwargs)