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