##// END OF EJS Templates
svn: Remove print statement and add __name__ to logger.
Martin Bornhold -
r566:884904c0 default
parent child Browse files
Show More
@@ -1,80 +1,80 b''
1 # Copyright (C) 2016-2016 RhodeCode GmbH
1 # Copyright (C) 2016-2016 RhodeCode GmbH
2 #
2 #
3 # This program is free software: you can redistribute it and/or modify
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
4 # it under the terms of the GNU Affero General Public License, version 3
5 # (only), as published by the Free Software Foundation.
5 # (only), as published by the Free Software Foundation.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU Affero General Public License
12 # You should have received a copy of the GNU Affero General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
14 #
15 # This program is dual-licensed. If you wish to learn more about the
15 # This program is dual-licensed. If you wish to learn more about the
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 import logging
19 import logging
20
20
21 from rhodecode.translation import lazy_ugettext
21 from rhodecode.translation import lazy_ugettext
22 from rhodecode.events.base import RhodecodeEvent
22 from rhodecode.events.base import RhodecodeEvent
23
23
24
24
25 log = logging.getLogger()
25 log = logging.getLogger(__name__)
26
26
27
27
28 class RepoGroupEvent(RhodecodeEvent):
28 class RepoGroupEvent(RhodecodeEvent):
29 """
29 """
30 Base class for events acting on a repository group.
30 Base class for events acting on a repository group.
31
31
32 :param repo: a :class:`RepositoryGroup` instance
32 :param repo: a :class:`RepositoryGroup` instance
33 """
33 """
34
34
35 def __init__(self, repo_group):
35 def __init__(self, repo_group):
36 super(RepoGroupEvent, self).__init__()
36 super(RepoGroupEvent, self).__init__()
37 self.repo_group = repo_group
37 self.repo_group = repo_group
38
38
39 def as_dict(self):
39 def as_dict(self):
40 data = super(RepoGroupEvent, self).as_dict()
40 data = super(RepoGroupEvent, self).as_dict()
41 data.update({
41 data.update({
42 'repo_group': {
42 'repo_group': {
43 'group_id': self.repo_group.group_id,
43 'group_id': self.repo_group.group_id,
44 'group_name': self.repo_group.group_name,
44 'group_name': self.repo_group.group_name,
45 'group_parent_id': self.repo_group.group_parent_id,
45 'group_parent_id': self.repo_group.group_parent_id,
46 'group_description': self.repo_group.group_description,
46 'group_description': self.repo_group.group_description,
47 'user_id': self.repo_group.user_id,
47 'user_id': self.repo_group.user_id,
48 'created_by': self.repo_group.user.username,
48 'created_by': self.repo_group.user.username,
49 'created_on': self.repo_group.created_on,
49 'created_on': self.repo_group.created_on,
50 'enable_locking': self.repo_group.enable_locking,
50 'enable_locking': self.repo_group.enable_locking,
51 }
51 }
52 })
52 })
53 return data
53 return data
54
54
55
55
56 class RepoGroupCreateEvent(RepoGroupEvent):
56 class RepoGroupCreateEvent(RepoGroupEvent):
57 """
57 """
58 An instance of this class is emitted as an :term:`event` whenever a
58 An instance of this class is emitted as an :term:`event` whenever a
59 repository group is created.
59 repository group is created.
60 """
60 """
61 name = 'repo-group-create'
61 name = 'repo-group-create'
62 display_name = lazy_ugettext('repository group created')
62 display_name = lazy_ugettext('repository group created')
63
63
64
64
65 class RepoGroupDeleteEvent(RepoGroupEvent):
65 class RepoGroupDeleteEvent(RepoGroupEvent):
66 """
66 """
67 An instance of this class is emitted as an :term:`event` whenever a
67 An instance of this class is emitted as an :term:`event` whenever a
68 repository group is deleted.
68 repository group is deleted.
69 """
69 """
70 name = 'repo-group-delete'
70 name = 'repo-group-delete'
71 display_name = lazy_ugettext('repository group deleted')
71 display_name = lazy_ugettext('repository group deleted')
72
72
73
73
74 class RepoGroupUpdateEvent(RepoGroupEvent):
74 class RepoGroupUpdateEvent(RepoGroupEvent):
75 """
75 """
76 An instance of this class is emitted as an :term:`event` whenever a
76 An instance of this class is emitted as an :term:`event` whenever a
77 repository group is updated.
77 repository group is updated.
78 """
78 """
79 name = 'repo-group-update'
79 name = 'repo-group-update'
80 display_name = lazy_ugettext('repository group update')
80 display_name = lazy_ugettext('repository group update')
@@ -1,57 +1,55 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2016-2016 RhodeCode GmbH
3 # Copyright (C) 2016-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import os
21 import os
22
22
23 from pyramid.renderers import render
23 from pyramid.renderers import render
24
24
25 from rhodecode.model.db import RepoGroup
25 from rhodecode.model.db import RepoGroup
26 from . import keys
26 from . import keys
27
27
28
28
29 def generate_mod_dav_svn_config(settings):
29 def generate_mod_dav_svn_config(settings):
30 """
30 """
31 Generate the configuration file for use with subversion's mod_dav_svn
31 Generate the configuration file for use with subversion's mod_dav_svn
32 module. The configuration has to contain a <Location> block for each
32 module. The configuration has to contain a <Location> block for each
33 available repository group because the mod_dav_svn module does not support
33 available repository group because the mod_dav_svn module does not support
34 repositories organized in sub folders.
34 repositories organized in sub folders.
35 """
35 """
36 filepath = settings[keys.config_file_path]
36 filepath = settings[keys.config_file_path]
37 parent_path_root = settings[keys.parent_path_root]
37 parent_path_root = settings[keys.parent_path_root]
38 list_parent_path = settings[keys.list_parent_path]
38 list_parent_path = settings[keys.list_parent_path]
39 location_root = settings[keys.location_root]
39 location_root = settings[keys.location_root]
40
40
41 # Render the configuration to string.
41 # Render the configuration to string.
42 template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako'
42 template = 'rhodecode:svn_support/templates/mod-dav-svn.conf.mako'
43 context = {
43 context = {
44 'location_root': location_root,
44 'location_root': location_root,
45 'location_root_stripped': location_root.rstrip(os.path.sep),
45 'location_root_stripped': location_root.rstrip(os.path.sep),
46 'parent_path_root': parent_path_root,
46 'parent_path_root': parent_path_root,
47 'parent_path_root_stripped': parent_path_root.rstrip(os.path.sep),
47 'parent_path_root_stripped': parent_path_root.rstrip(os.path.sep),
48 'repo_groups': RepoGroup.get_all_repo_groups(),
48 'repo_groups': RepoGroup.get_all_repo_groups(),
49 'svn_list_parent_path': list_parent_path,
49 'svn_list_parent_path': list_parent_path,
50 }
50 }
51 mod_dav_svn_config = render(template, context)
51 mod_dav_svn_config = render(template, context)
52
52
53 print mod_dav_svn_config
54
55 # Write configuration to file.
53 # Write configuration to file.
56 with open(filepath, 'w') as file_:
54 with open(filepath, 'w') as file_:
57 file_.write(mod_dav_svn_config)
55 file_.write(mod_dav_svn_config)
General Comments 0
You need to be logged in to leave comments. Login now