Show More
@@ -1,77 +1,80 b'' | |||
|
1 | 1 | # Copyright (C) 2016-2016 RhodeCode GmbH |
|
2 | 2 | # |
|
3 | 3 | # This program is free software: you can redistribute it and/or modify |
|
4 | 4 | # it under the terms of the GNU Affero General Public License, version 3 |
|
5 | 5 | # (only), as published by the Free Software Foundation. |
|
6 | 6 | # |
|
7 | 7 | # This program is distributed in the hope that it will be useful, |
|
8 | 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 | 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 | 10 | # GNU General Public License for more details. |
|
11 | 11 | # |
|
12 | 12 | # You should have received a copy of the GNU Affero General Public License |
|
13 | 13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | 14 | # |
|
15 | 15 | # This program is dual-licensed. If you wish to learn more about the |
|
16 | 16 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
17 | 17 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
18 | 18 | |
|
19 | 19 | import logging |
|
20 | 20 | |
|
21 | 21 | from rhodecode.translation import lazy_ugettext |
|
22 | 22 | from rhodecode.events.base import RhodecodeEvent |
|
23 | 23 | |
|
24 | ||
|
24 | 25 | log = logging.getLogger() |
|
25 | 26 | |
|
26 | 27 | |
|
27 | 28 | class RepoGroupEvent(RhodecodeEvent): |
|
28 | 29 | """ |
|
29 | 30 | Base class for events acting on a repository group. |
|
30 | 31 | |
|
31 | 32 | :param repo: a :class:`RepositoryGroup` instance |
|
32 | 33 | """ |
|
33 | 34 | |
|
34 | 35 | def __init__(self, repo_group): |
|
35 | 36 | super(RepoGroupEvent, self).__init__() |
|
36 | 37 | self.repo_group = repo_group |
|
37 | 38 | |
|
38 | # TODO: Implement this | |
|
39 | # def as_dict(self): | |
|
40 | # from rhodecode.model.repo import RepoModel | |
|
41 | # data = super(RepoGroupEvent, self).as_dict() | |
|
42 | # data.update({ | |
|
43 | # 'repo': { | |
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 | # 'url': RepoModel().get_url(self.repo) | |
|
48 | # } | |
|
49 | # }) | |
|
50 | # return data | |
|
39 | def as_dict(self): | |
|
40 | data = super(RepoGroupEvent, self).as_dict() | |
|
41 | data.update({ | |
|
42 | 'repo_group': { | |
|
43 | 'group_id': self.repo_group.group_id, | |
|
44 | 'group_name': self.repo_group.group_name, | |
|
45 | 'group_parent_id': self.repo_group.group_parent_id, | |
|
46 | 'group_description': self.repo_group.group_description, | |
|
47 | 'user_id': self.repo_group.user_id, | |
|
48 | 'created_by': self.repo_group.user.username, | |
|
49 | 'created_on': self.repo_group.created_on, | |
|
50 | 'enable_locking': self.repo_group.enable_locking, | |
|
51 | } | |
|
52 | }) | |
|
53 | return data | |
|
51 | 54 | |
|
52 | 55 | |
|
53 | 56 | class RepoGroupCreateEvent(RepoGroupEvent): |
|
54 | 57 | """ |
|
55 | 58 | An instance of this class is emitted as an :term:`event` whenever a |
|
56 | 59 | repository group is created. |
|
57 | 60 | """ |
|
58 | 61 | name = 'repo-group-create' |
|
59 | 62 | display_name = lazy_ugettext('repository group created') |
|
60 | 63 | |
|
61 | 64 | |
|
62 | 65 | class RepoGroupDeleteEvent(RepoGroupEvent): |
|
63 | 66 | """ |
|
64 | 67 | An instance of this class is emitted as an :term:`event` whenever a |
|
65 | 68 | repository group is deleted. |
|
66 | 69 | """ |
|
67 | 70 | name = 'repo-group-delete' |
|
68 | 71 | display_name = lazy_ugettext('repository group deleted') |
|
69 | 72 | |
|
70 | 73 | |
|
71 | 74 | class RepoGroupUpdateEvent(RepoGroupEvent): |
|
72 | 75 | """ |
|
73 | 76 | An instance of this class is emitted as an :term:`event` whenever a |
|
74 | 77 | repository group is updated. |
|
75 | 78 | """ |
|
76 | 79 | name = 'repo-group-update' |
|
77 | 80 | display_name = lazy_ugettext('repository group update') |
General Comments 0
You need to be logged in to leave comments.
Login now