Show More
@@ -25,6 +25,7 b' Set of hooks run by RhodeCode Enterprise' | |||||
25 |
|
25 | |||
26 | import os |
|
26 | import os | |
27 | import collections |
|
27 | import collections | |
|
28 | import logging | |||
28 |
|
29 | |||
29 | import rhodecode |
|
30 | import rhodecode | |
30 | from rhodecode import events |
|
31 | from rhodecode import events | |
@@ -34,6 +35,8 b' from rhodecode.lib.utils2 import safe_st' | |||||
34 | from rhodecode.lib.exceptions import HTTPLockedRC, UserCreationError |
|
35 | from rhodecode.lib.exceptions import HTTPLockedRC, UserCreationError | |
35 | from rhodecode.model.db import Repository, User |
|
36 | from rhodecode.model.db import Repository, User | |
36 |
|
37 | |||
|
38 | log = logging.getLogger(__name__) | |||
|
39 | ||||
37 |
|
40 | |||
38 | HookResponse = collections.namedtuple('HookResponse', ('status', 'output')) |
|
41 | HookResponse = collections.namedtuple('HookResponse', ('status', 'output')) | |
39 |
|
42 | |||
@@ -91,7 +94,6 b' def pre_push(extras):' | |||||
91 | It bans pushing when the repository is locked. |
|
94 | It bans pushing when the repository is locked. | |
92 | """ |
|
95 | """ | |
93 | usr = User.get_by_username(extras.username) |
|
96 | usr = User.get_by_username(extras.username) | |
94 |
|
||||
95 | output = '' |
|
97 | output = '' | |
96 | if extras.locked_by[0] and usr.user_id != int(extras.locked_by[0]): |
|
98 | if extras.locked_by[0] and usr.user_id != int(extras.locked_by[0]): | |
97 | locked_by = User.get(extras.locked_by[0]).username |
|
99 | locked_by = User.get(extras.locked_by[0]).username | |
@@ -251,10 +253,14 b' class ExtensionCallback(object):' | |||||
251 | self._kwargs_keys = set(kwargs_keys) |
|
253 | self._kwargs_keys = set(kwargs_keys) | |
252 |
|
254 | |||
253 | def __call__(self, *args, **kwargs): |
|
255 | def __call__(self, *args, **kwargs): | |
|
256 | log.debug('Calling extension callback for %s', self._hook_name) | |||
|
257 | ||||
254 | kwargs_to_pass = dict((key, kwargs[key]) for key in self._kwargs_keys) |
|
258 | kwargs_to_pass = dict((key, kwargs[key]) for key in self._kwargs_keys) | |
255 | callback = self._get_callback() |
|
259 | callback = self._get_callback() | |
256 | if callback: |
|
260 | if callback: | |
257 | return callback(**kwargs_to_pass) |
|
261 | return callback(**kwargs_to_pass) | |
|
262 | else: | |||
|
263 | log.debug('extensions callback not found skipping...') | |||
258 |
|
264 | |||
259 | def is_active(self): |
|
265 | def is_active(self): | |
260 | return hasattr(rhodecode.EXTENSIONS, self._hook_name) |
|
266 | return hasattr(rhodecode.EXTENSIONS, self._hook_name) |
General Comments 0
You need to be logged in to leave comments.
Login now