##// END OF EJS Templates
whitespace cleanup
marcink -
r2973:9937afa7 beta
parent child Browse files
Show More
@@ -1,31 +1,31 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.middleware.errormator
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 middleware to handle errormator publishing of errors
7 7
8 8 :created_on: October 18, 2012
9 9 :author: marcink
10 10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 11 :license: GPLv3, see COPYING for more details.
12 12 """
13 13 # This program is free software: you can redistribute it and/or modify
14 14 # it under the terms of the GNU General Public License as published by
15 15 # the Free Software Foundation, either version 3 of the License, or
16 16 # (at your option) any later version.
17 17 #
18 18 # This program is distributed in the hope that it will be useful,
19 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 21 # GNU General Public License for more details.
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26 26 try:
27 27 from errormator_client import make_errormator_middleware
28 28 except ImportError:
29 29 Errormator = None
30 30 else:
31 Errormator = make_errormator_middleware No newline at end of file
31 Errormator = make_errormator_middleware
@@ -1,47 +1,47 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.middleware.sentry
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 middleware to handle sentry/raven publishing of errors
7 7
8 8 :created_on: September 18, 2012
9 9 :author: marcink
10 10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 11 :license: GPLv3, see COPYING for more details.
12 12 """
13 13 # This program is free software: you can redistribute it and/or modify
14 14 # it under the terms of the GNU General Public License as published by
15 15 # the Free Software Foundation, either version 3 of the License, or
16 16 # (at your option) any later version.
17 17 #
18 18 # This program is distributed in the hope that it will be useful,
19 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 21 # GNU General Public License for more details.
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26 26 try:
27 27 from raven.base import Client
28 28 from raven.contrib.pylons import list_from_setting
29 29 from raven.middleware import Sentry as Middleware
30 30 except ImportError:
31 31 Sentry = None
32 32 else:
33 33 class Sentry(Middleware):
34 34 def __init__(self, app, config, client_cls=Client):
35 35 client = client_cls(
36 36 dsn=config.get('sentry.dsn'),
37 37 servers=list_from_setting(config, 'sentry.servers'),
38 38 name=config.get('sentry.name'),
39 39 key=config.get('sentry.key'),
40 40 public_key=config.get('sentry.public_key'),
41 41 secret_key=config.get('sentry.secret_key'),
42 42 project=config.get('sentry.project'),
43 43 site=config.get('sentry.site'),
44 44 include_paths=list_from_setting(config, 'sentry.include_paths'),
45 45 exclude_paths=list_from_setting(config, 'sentry.exclude_paths'),
46 46 )
47 super(Sentry, self).__init__(app, client) No newline at end of file
47 super(Sentry, self).__init__(app, client)
@@ -1,47 +1,47 b''
1 1 %if c.user_repos:
2 2 <div id='repos_list_wrap' class="yui-skin-sam">
3 3 <table id="repos_list">
4 4 <thead>
5 5 <tr>
6 6 <th></th>
7 7 <th class="left">${_('Name')}</th>
8 8 <th class="left">${_('Revision')}</th>
9 9 <th class="left">${_('Action')}</th>
10 10 <th class="left">${_('Action')}</th>
11 11 </thead>
12 12 <tbody>
13 13 <%namespace name="dt" file="/data_table/_dt_elements.html"/>
14 14 %for repo in c.user_repos:
15 15 <tr>
16 16 ##QUICK MENU
17 17 <td class="quick_repo_menu">
18 18 ${dt.quick_menu(repo['name'])}
19 19 </td>
20 20 ##REPO NAME AND ICONS
21 21 <td class="reponame">
22 22 ${dt.repo_name(repo['name'],repo['dbrepo']['repo_type'],repo['dbrepo']['private'],h.AttributeDict(repo['dbrepo_fork']))}
23 23 </td>
24 24 ##LAST REVISION
25 25 <td>
26 26 ${dt.revision(repo['name'],repo['rev'],repo['tip'],repo['author'],repo['last_msg'])}
27 27 </td>
28 28 ##
29 29 <td><a href="${h.url('repo_settings_home',repo_name=repo['name'])}" title="${_('edit')}"><img class="icon" alt="${_('private')}" src="${h.url('/images/icons/application_form_edit.png')}"/></a></td>
30 30 <td>
31 31 ${h.form(url('repo_settings_delete', repo_name=repo['name']),method='delete')}
32 32 ${h.submit('remove_%s' % repo['name'],'',class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo['name']+"');")}
33 33 ${h.end_form()}
34 34 </td>
35 35 </tr>
36 36 %endfor
37 37 </tbody>
38 38 </table>
39 39 </div>
40 40 %else:
41 41 <div style="padding:5px 0px 10px 0px;">
42 42 ${_('No repositories yet')}
43 43 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
44 44 ${h.link_to(_('create one now'),h.url('admin_settings_create_repository'),class_="ui-btn")}
45 45 %endif
46 46 </div>
47 %endif No newline at end of file
47 %endif
@@ -1,79 +1,78 b''
1 1 import time
2 2 from rhodecode.tests import *
3 3 from rhodecode.model.meta import Session
4 4 from rhodecode.model.db import User, RhodeCodeSetting, Repository
5 5 from rhodecode.lib.utils import set_rhodecode_config
6 6
7 7
8 8 class TestHomeController(TestController):
9 9
10 10 def test_index(self):
11 11 self.log_user()
12 12 response = self.app.get(url(controller='home', action='index'))
13 13 #if global permission is set
14 14 response.mustcontain('ADD REPOSITORY')
15 15 response.mustcontain('href="/%s/summary"' % HG_REPO)
16 16
17 17 response.mustcontain("""<img class="icon" title="Mercurial repository" """
18 18 """alt="Mercurial repository" src="/images/icons/hg"""
19 19 """icon.png"/>""")
20 20 response.mustcontain("""<img class="icon" title="public repository" """
21 21 """alt="public repository" src="/images/icons/lock_"""
22 22 """open.png"/>""")
23 23
24 24 response.mustcontain(
25 25 """<a title="Marcin Kuzminski &amp;lt;marcin@python-works.com&amp;gt;:\n
26 26 merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232"""
27 27 """dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>"""
28 28 )
29 29
30 30 def test_repo_summary_with_anonymous_access_disabled(self):
31 31 anon = User.get_by_username('default')
32 32 anon.active = False
33 33 Session().add(anon)
34 34 Session().commit()
35 35 time.sleep(1.5) # must sleep for cache (1s to expire)
36 36 try:
37 37 response = self.app.get(url(controller='summary',
38 38 action='index', repo_name=HG_REPO),
39 39 status=302)
40 40 assert 'login' in response.location
41 41
42 42 finally:
43 43 anon = User.get_by_username('default')
44 44 anon.active = True
45 45 Session().add(anon)
46 46 Session().commit()
47 47
48 48 def test_index_with_anonymous_access_disabled(self):
49 49 anon = User.get_by_username('default')
50 50 anon.active = False
51 51 Session().add(anon)
52 52 Session().commit()
53 53 time.sleep(1.5) # must sleep for cache (1s to expire)
54 54 try:
55 55 response = self.app.get(url(controller='home', action='index'),
56 56 status=302)
57 57 assert 'login' in response.location
58 58 finally:
59 59 anon = User.get_by_username('default')
60 60 anon.active = True
61 61 Session().add(anon)
62 62 Session().commit()
63 63
64 64 def test_index_with_lightweight_dashboard(self):
65 65 self.log_user()
66 66
67 67 def set_l_dash(set_to):
68 68 self.app.post(url('admin_setting', setting_id='visual'),
69 69 params=dict(_method='put',
70 70 rhodecode_lightweight_dashboard=set_to,))
71 71
72 72 set_l_dash(True)
73 73
74 74 try:
75 75 response = self.app.get(url(controller='home', action='index'))
76 76 response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll()))
77 77 finally:
78 78 set_l_dash(False)
79
General Comments 0
You need to be logged in to leave comments. Login now