##// END OF EJS Templates
added __license__ into main of rhodecode, PEP8ify
marcink -
r1205:f4807acf beta
parent child Browse files
Show More
@@ -1,56 +1,58 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.__init__
4 4 ~~~~~~~~~~~~~~~~~~
5 5
6 6 RhodeCode, a web based repository management based on pylons
7 7 versioning implementation: http://semver.org/
8 8
9 9 :created_on: Apr 9, 2010
10 10 :author: marcink
11 11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software; you can redistribute it and/or
15 15 # modify it under the terms of the GNU General Public License
16 16 # as published by the Free Software Foundation; version 2
17 17 # of the License or (at your opinion) any later version of the license.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program; if not, write to the Free Software
26 26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 27 # MA 02110-1301, USA.
28 28 import platform
29 29
30 30 VERSION = (1, 2, 0, 'beta')
31 31 __version__ = '.'.join((str(each) for each in VERSION[:4]))
32 32 __dbversion__ = 3 #defines current db version for migrations
33 33 __platform__ = platform.system()
34 __license__ = 'GPLv3'
34 35
35 PLATFORM_WIN = ('Windows',)
36 PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD',)
36 PLATFORM_WIN = ('Windows')
37 PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD')
37 38
38 39 try:
39 40 from rhodecode.lib.utils import get_current_revision
40 41 _rev = get_current_revision()
41 42 except ImportError:
42 43 #this is needed when doing some setup.py operations
43 44 _rev = False
44 45
45 46 if len(VERSION) > 3 and _rev:
46 47 __version__ += ' [rev:%s]' % _rev[0]
47 48
49
48 50 def get_version():
49 51 """Returns shorter version (digit parts only) as string."""
50 52
51 53 return '.'.join((str(each) for each in VERSION[:3]))
52 54
53 55 BACKENDS = {
54 56 'hg': 'Mercurial repository',
55 57 #'git': 'Git repository',
56 58 }
@@ -1,84 +1,85 b''
1 1 """Pylons environment configuration"""
2 2
3 3 import os
4 4 import logging
5 5
6 6 from mako.lookup import TemplateLookup
7 7 from pylons.configuration import PylonsConfig
8 8 from pylons.error import handle_mako_error
9 9 from sqlalchemy import engine_from_config
10 10
11 11 import rhodecode.lib.app_globals as app_globals
12 12 import rhodecode.lib.helpers
13 13
14 14 from rhodecode.config.routing import make_map
15 15 from rhodecode.lib import celerypylons
16 16 from rhodecode.lib.auth import set_available_permissions
17 17 from rhodecode.lib.utils import repo2db_mapper, make_ui, set_rhodecode_config
18 18 from rhodecode.model import init_model
19 19 from rhodecode.model.scm import ScmModel
20 20 from rhodecode.lib.timerproxy import TimerProxy
21 21
22 22 log = logging.getLogger(__name__)
23 23
24
24 25 def load_environment(global_conf, app_conf, initial=False):
25 26 """Configure the Pylons environment via the ``pylons.config``
26 27 object
27 28 """
28 29 config = PylonsConfig()
29 30
30 31 # Pylons paths
31 32 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
32 33 paths = dict(root=root,
33 34 controllers=os.path.join(root, 'controllers'),
34 35 static_files=os.path.join(root, 'public'),
35 36 templates=[os.path.join(root, 'templates')])
36 37
37 38 # Initialize config with the basic options
38 39 config.init_app(global_conf, app_conf, package='rhodecode', paths=paths)
39 40
40 41 config['routes.map'] = make_map(config)
41 42 config['pylons.app_globals'] = app_globals.Globals(config)
42 43 config['pylons.h'] = rhodecode.lib.helpers
43 44
44 45 # Setup cache object as early as possible
45 46 import pylons
46 47 pylons.cache._push_object(config['pylons.app_globals'].cache)
47 48
48 49 # Create the Mako TemplateLookup, with the default auto-escaping
49 50 config['pylons.app_globals'].mako_lookup = TemplateLookup(
50 51 directories=paths['templates'],
51 52 error_handler=handle_mako_error,
52 53 module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
53 54 input_encoding='utf-8', default_filters=['escape'],
54 55 imports=['from webhelpers.html import escape'])
55 56
56 57 #sets the c attribute access when don't existing attribute are accessed
57 58 config['pylons.strict_tmpl_context'] = True
58 59 test = os.path.split(config['__file__'])[-1] == 'test.ini'
59 60 if test:
60 61 from rhodecode.lib.utils import create_test_env, create_test_index
61 62 from rhodecode.tests import TESTS_TMP_PATH
62 63 create_test_env(TESTS_TMP_PATH, config)
63 64 create_test_index(TESTS_TMP_PATH, True)
64 65
65 66 #MULTIPLE DB configs
66 67 # Setup the SQLAlchemy database engine
67 68 if config['debug'] and not test:
68 69 #use query time debugging.
69 70 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.',
70 proxy=TimerProxy())
71 proxy=TimerProxy())
71 72 else:
72 73 sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
73 74
74 75 init_model(sa_engine_db1)
75 76
76 77 repos_path = make_ui('db').configitems('paths')[0][1]
77 78 repo2db_mapper(ScmModel().repo_scan(repos_path))
78 79 set_available_permissions(config)
79 80 config['base_path'] = repos_path
80 81 set_rhodecode_config(config)
81 82 # CONFIGURATION OPTIONS HERE (note: all config options will override
82 83 # any Pylons config options)
83 84
84 85 return config
@@ -1,78 +1,79 b''
1 1 """Pylons middleware initialization"""
2 2
3 3 from beaker.middleware import SessionMiddleware
4 4 from routes.middleware import RoutesMiddleware
5 5 from paste.cascade import Cascade
6 6 from paste.registry import RegistryManager
7 7 from paste.urlparser import StaticURLParser
8 8 from paste.deploy.converters import asbool
9 9 from paste.gzipper import make_gzip_middleware
10 10
11 11 from pylons.middleware import ErrorHandler, StatusCodeRedirect
12 12 from pylons.wsgiapp import PylonsApp
13 13
14 14 from rhodecode.lib.middleware.simplehg import SimpleHg
15 15 from rhodecode.lib.middleware.simplegit import SimpleGit
16 16 from rhodecode.lib.middleware.https_fixup import HttpsFixup
17 17 from rhodecode.config.environment import load_environment
18 18
19
19 20 def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
20 21 """Create a Pylons WSGI application and return it
21 22
22 23 ``global_conf``
23 24 The inherited configuration for this application. Normally from
24 25 the [DEFAULT] section of the Paste ini file.
25 26
26 27 ``full_stack``
27 28 Whether or not this application provides a full WSGI stack (by
28 29 default, meaning it handles its own exceptions and errors).
29 30 Disable full_stack when this application is "managed" by
30 31 another WSGI middleware.
31 32
32 33 ``app_conf``
33 34 The application's local configuration. Normally specified in
34 35 the [app:<name>] section of the Paste ini file (where <name>
35 36 defaults to main).
36 37
37 38 """
38 39 # Configure the Pylons environment
39 40 config = load_environment(global_conf, app_conf)
40 41
41 42 # The Pylons WSGI app
42 43 app = PylonsApp(config=config)
43 44
44 45 # Routing/Session/Cache Middleware
45 46 app = RoutesMiddleware(app, config['routes.map'])
46 47 app = SessionMiddleware(app, config)
47 48
48 49 # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
49 50
50 51 app = SimpleHg(app, config)
51 52 app = SimpleGit(app, config)
52 53
53 54 if asbool(full_stack):
54 55 # Handle Python exceptions
55 56 app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
56 57
57 58 # Display error documents for 401, 403, 404 status codes (and
58 59 # 500 when debug is disabled)
59 60 if asbool(config['debug']):
60 61 app = StatusCodeRedirect(app)
61 62 else:
62 63 app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])
63 64
64 65 #enable https redirets based on HTTP_X_URL_SCHEME set by proxy
65 66 app = HttpsFixup(app, config)
66 67
67 68 # Establish the Registry for this application
68 69 app = RegistryManager(app)
69 70
70 71 if asbool(static_files):
71 72 # Serve static files
72 73 static_app = StaticURLParser(config['pylons.paths']['static_files'])
73 74 app = Cascade([static_app, app])
74 75 app = make_gzip_middleware(app, global_conf, compress_level=1)
75 76
76 77 app.config = config
77 78
78 79 return app
@@ -1,241 +1,241 b''
1 1 """
2 2 Routes configuration
3 3
4 4 The more specific and detailed routes should be defined first so they
5 5 may take precedent over the more generic routes. For more information
6 6 refer to the routes manual at http://routes.groovie.org/docs/
7 7 """
8 8 from __future__ import with_statement
9 9 from routes import Mapper
10 10 from rhodecode.lib.utils import check_repo_fast as cr
11 11
12
12 13 def make_map(config):
13 14 """Create, configure and return the routes Mapper"""
14 15 routes_map = Mapper(directory=config['pylons.paths']['controllers'],
15 16 always_scan=config['debug'])
16 17 routes_map.minimization = False
17 18 routes_map.explicit = False
18 19
19 20 def check_repo(environ, match_dict):
20 21 """
21 22 check for valid repository for proper 404 handling
22 23
23 24 :param environ:
24 25 :param match_dict:
25 26 """
26 27 repo_name = match_dict.get('repo_name')
27 28 return not cr(repo_name, config['base_path'])
28 29
29 30 # The ErrorController route (handles 404/500 error pages); it should
30 31 # likely stay at the top, ensuring it can always be resolved
31 32 routes_map.connect('/error/{action}', controller='error')
32 33 routes_map.connect('/error/{action}/{id}', controller='error')
33 34
34 35 #==========================================================================
35 36 # CUSTOM ROUTES HERE
36 37 #==========================================================================
37 38
38 39 #MAIN PAGE
39 40 routes_map.connect('home', '/', controller='home', action='index')
40 41 routes_map.connect('repo_switcher', '/repos', controller='home', action='repo_switcher')
41 42 routes_map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
42 routes_map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
43 43 routes_map.connect('rhodecode_official', "http://rhodecode.org", _static=True)
44 44
45 45 #ADMIN REPOSITORY REST ROUTES
46 46 with routes_map.submapper(path_prefix='/_admin', controller='admin/repos') as m:
47 47 m.connect("repos", "/repos",
48 48 action="create", conditions=dict(method=["POST"]))
49 49 m.connect("repos", "/repos",
50 50 action="index", conditions=dict(method=["GET"]))
51 51 m.connect("formatted_repos", "/repos.{format}",
52 52 action="index",
53 53 conditions=dict(method=["GET"]))
54 54 m.connect("new_repo", "/repos/new",
55 55 action="new", conditions=dict(method=["GET"]))
56 56 m.connect("formatted_new_repo", "/repos/new.{format}",
57 57 action="new", conditions=dict(method=["GET"]))
58 58 m.connect("/repos/{repo_name:.*}",
59 59 action="update", conditions=dict(method=["PUT"],
60 60 function=check_repo))
61 61 m.connect("/repos/{repo_name:.*}",
62 62 action="delete", conditions=dict(method=["DELETE"],
63 63 function=check_repo))
64 64 m.connect("edit_repo", "/repos/{repo_name:.*}/edit",
65 65 action="edit", conditions=dict(method=["GET"],
66 66 function=check_repo))
67 67 m.connect("formatted_edit_repo", "/repos/{repo_name:.*}.{format}/edit",
68 68 action="edit", conditions=dict(method=["GET"],
69 69 function=check_repo))
70 70 m.connect("repo", "/repos/{repo_name:.*}",
71 71 action="show", conditions=dict(method=["GET"],
72 72 function=check_repo))
73 73 m.connect("formatted_repo", "/repos/{repo_name:.*}.{format}",
74 74 action="show", conditions=dict(method=["GET"],
75 75 function=check_repo))
76 76 #ajax delete repo perm user
77 77 m.connect('delete_repo_user', "/repos_delete_user/{repo_name:.*}",
78 78 action="delete_perm_user", conditions=dict(method=["DELETE"],
79 79 function=check_repo))
80 80 #ajax delete repo perm users_group
81 81 m.connect('delete_repo_users_group', "/repos_delete_users_group/{repo_name:.*}",
82 82 action="delete_perm_users_group", conditions=dict(method=["DELETE"],
83 83 function=check_repo))
84 84
85 85 #settings actions
86 86 m.connect('repo_stats', "/repos_stats/{repo_name:.*}",
87 87 action="repo_stats", conditions=dict(method=["DELETE"],
88 88 function=check_repo))
89 89 m.connect('repo_cache', "/repos_cache/{repo_name:.*}",
90 90 action="repo_cache", conditions=dict(method=["DELETE"],
91 91 function=check_repo))
92 92 m.connect('repo_public_journal', "/repos_public_journal/{repo_name:.*}",
93 93 action="repo_public_journal", conditions=dict(method=["PUT"],
94 94 function=check_repo))
95 95 m.connect('repo_pull', "/repo_pull/{repo_name:.*}",
96 96 action="repo_pull", conditions=dict(method=["PUT"],
97 97 function=check_repo))
98 98
99 99 #ADMIN REPOS GROUP REST ROUTES
100 100 routes_map.resource('repos_group', 'repos_groups', controller='admin/repos_groups', path_prefix='/_admin')
101 101
102 102 #ADMIN USER REST ROUTES
103 103 routes_map.resource('user', 'users', controller='admin/users', path_prefix='/_admin')
104 104
105 105 #ADMIN USERS REST ROUTES
106 106 routes_map.resource('users_group', 'users_groups', controller='admin/users_groups', path_prefix='/_admin')
107 107
108 108 #ADMIN GROUP REST ROUTES
109 109 routes_map.resource('group', 'groups', controller='admin/groups', path_prefix='/_admin')
110 110
111 111 #ADMIN PERMISSIONS REST ROUTES
112 112 routes_map.resource('permission', 'permissions', controller='admin/permissions', path_prefix='/_admin')
113 113
114 114 ##ADMIN LDAP SETTINGS
115 115 routes_map.connect('ldap_settings', '/_admin/ldap', controller='admin/ldap_settings',
116 116 action='ldap_settings', conditions=dict(method=["POST"]))
117 routes_map.connect('ldap_home', '/_admin/ldap', controller='admin/ldap_settings',)
117 routes_map.connect('ldap_home', '/_admin/ldap', controller='admin/ldap_settings')
118 118
119 119
120 120 #ADMIN SETTINGS REST ROUTES
121 121 with routes_map.submapper(path_prefix='/_admin', controller='admin/settings') as m:
122 122 m.connect("admin_settings", "/settings",
123 123 action="create", conditions=dict(method=["POST"]))
124 124 m.connect("admin_settings", "/settings",
125 125 action="index", conditions=dict(method=["GET"]))
126 126 m.connect("formatted_admin_settings", "/settings.{format}",
127 127 action="index", conditions=dict(method=["GET"]))
128 128 m.connect("admin_new_setting", "/settings/new",
129 129 action="new", conditions=dict(method=["GET"]))
130 130 m.connect("formatted_admin_new_setting", "/settings/new.{format}",
131 131 action="new", conditions=dict(method=["GET"]))
132 132 m.connect("/settings/{setting_id}",
133 133 action="update", conditions=dict(method=["PUT"]))
134 134 m.connect("/settings/{setting_id}",
135 135 action="delete", conditions=dict(method=["DELETE"]))
136 136 m.connect("admin_edit_setting", "/settings/{setting_id}/edit",
137 137 action="edit", conditions=dict(method=["GET"]))
138 138 m.connect("formatted_admin_edit_setting", "/settings/{setting_id}.{format}/edit",
139 139 action="edit", conditions=dict(method=["GET"]))
140 140 m.connect("admin_setting", "/settings/{setting_id}",
141 141 action="show", conditions=dict(method=["GET"]))
142 142 m.connect("formatted_admin_setting", "/settings/{setting_id}.{format}",
143 143 action="show", conditions=dict(method=["GET"]))
144 144 m.connect("admin_settings_my_account", "/my_account",
145 145 action="my_account", conditions=dict(method=["GET"]))
146 146 m.connect("admin_settings_my_account_update", "/my_account_update",
147 147 action="my_account_update", conditions=dict(method=["PUT"]))
148 148 m.connect("admin_settings_create_repository", "/create_repository",
149 149 action="create_repository", conditions=dict(method=["GET"]))
150 150
151 151 #ADMIN MAIN PAGES
152 152 with routes_map.submapper(path_prefix='/_admin', controller='admin/admin') as m:
153 153 m.connect('admin_home', '', action='index')#main page
154 154 m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
155 155 action='add_repo')
156 156
157 157
158 158 #USER JOURNAL
159 routes_map.connect('journal', '/_admin/journal', controller='journal',)
159 routes_map.connect('journal', '/_admin/journal', controller='journal')
160 160 routes_map.connect('public_journal', '/_admin/public_journal', controller='journal', action="public_journal")
161 161 routes_map.connect('public_journal_rss', '/_admin/public_journal_rss', controller='journal', action="public_journal_rss")
162 162 routes_map.connect('public_journal_atom', '/_admin/public_journal_atom', controller='journal', action="public_journal_atom")
163 163
164 164 routes_map.connect('toggle_following', '/_admin/toggle_following', controller='journal',
165 165 action='toggle_following', conditions=dict(method=["POST"]))
166 166
167 167
168 168 #SEARCH
169 routes_map.connect('search', '/_admin/search', controller='search',)
169 routes_map.connect('search', '/_admin/search', controller='search')
170 170 routes_map.connect('search_repo', '/_admin/search/{search_repo:.*}', controller='search')
171 171
172 172 #LOGIN/LOGOUT/REGISTER/SIGN IN
173 173 routes_map.connect('login_home', '/_admin/login', controller='login')
174 174 routes_map.connect('logout_home', '/_admin/logout', controller='login', action='logout')
175 175 routes_map.connect('register', '/_admin/register', controller='login', action='register')
176 176 routes_map.connect('reset_password', '/_admin/password_reset', controller='login', action='password_reset')
177 177
178 178 #FEEDS
179 179 routes_map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss',
180 180 controller='feed', action='rss',
181 181 conditions=dict(function=check_repo))
182 182 routes_map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom',
183 183 controller='feed', action='atom',
184 184 conditions=dict(function=check_repo))
185 185
186 186
187 187 #REPOSITORY ROUTES
188 188 routes_map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}',
189 189 controller='changeset', revision='tip',
190 190 conditions=dict(function=check_repo))
191 191 routes_map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}',
192 192 controller='changeset', action='raw_changeset', revision='tip',
193 193 conditions=dict(function=check_repo))
194 194 routes_map.connect('summary_home', '/{repo_name:.*}',
195 195 controller='summary', conditions=dict(function=check_repo))
196 196 routes_map.connect('summary_home', '/{repo_name:.*}/summary',
197 197 controller='summary', conditions=dict(function=check_repo))
198 198 routes_map.connect('shortlog_home', '/{repo_name:.*}/shortlog',
199 199 controller='shortlog', conditions=dict(function=check_repo))
200 200 routes_map.connect('branches_home', '/{repo_name:.*}/branches',
201 201 controller='branches', conditions=dict(function=check_repo))
202 202 routes_map.connect('tags_home', '/{repo_name:.*}/tags',
203 203 controller='tags', conditions=dict(function=check_repo))
204 204 routes_map.connect('changelog_home', '/{repo_name:.*}/changelog',
205 205 controller='changelog', conditions=dict(function=check_repo))
206 206 routes_map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
207 207 controller='files', revision='tip', f_path='',
208 208 conditions=dict(function=check_repo))
209 209 routes_map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
210 210 controller='files', action='diff', revision='tip', f_path='',
211 211 conditions=dict(function=check_repo))
212 212 routes_map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
213 213 controller='files', action='rawfile', revision='tip', f_path='',
214 214 conditions=dict(function=check_repo))
215 215 routes_map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}',
216 216 controller='files', action='raw', revision='tip', f_path='',
217 217 conditions=dict(function=check_repo))
218 218 routes_map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}',
219 219 controller='files', action='annotate', revision='tip', f_path='',
220 220 conditions=dict(function=check_repo))
221 221 routes_map.connect('files_archive_home', '/{repo_name:.*}/archive/{fname}',
222 222 controller='files', action='archivefile',
223 223 conditions=dict(function=check_repo))
224 224 routes_map.connect('repo_settings_delete', '/{repo_name:.*}/settings',
225 225 controller='settings', action="delete",
226 226 conditions=dict(method=["DELETE"], function=check_repo))
227 227 routes_map.connect('repo_settings_update', '/{repo_name:.*}/settings',
228 228 controller='settings', action="update",
229 229 conditions=dict(method=["PUT"], function=check_repo))
230 230 routes_map.connect('repo_settings_home', '/{repo_name:.*}/settings',
231 231 controller='settings', action='index',
232 232 conditions=dict(function=check_repo))
233 233
234 234 routes_map.connect('repo_fork_create_home', '/{repo_name:.*}/fork',
235 235 controller='settings', action='fork_create',
236 236 conditions=dict(function=check_repo, method=["POST"]))
237 237 routes_map.connect('repo_fork_home', '/{repo_name:.*}/fork',
238 238 controller='settings', action='fork',
239 239 conditions=dict(function=check_repo))
240 240
241 241 return routes_map
@@ -1,315 +1,312 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="root.html"/>
3 3
4 4 <!-- HEADER -->
5 5 <div id="header">
6 6 <!-- user -->
7 7 <ul id="logged-user">
8 8 <li class="first">
9 9 <div class="gravatar">
10 10 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
11 11 </div>
12 12 <div class="account">
13 13 %if c.rhodecode_user.username == 'default':
14 14 <a href="${h.url('public_journal')}">${_('Public journal')}</a>
15 15 %else:
16 16 ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
17 17 %endif
18 18 </div>
19 19 </li>
20 20 <li>
21 21 <a href="${h.url('home')}">${_('Home')}</a>
22 22 </li>
23 23 %if c.rhodecode_user.username != 'default':
24 24 <li>
25 25 <a href="${h.url('journal')}">${_('Journal')}</a>
26 26 ##(${c.unread_journal}
27 27 </li>
28 28 %endif
29 29 %if c.rhodecode_user.username == 'default':
30 30 <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
31 31 %else:
32 32 <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
33 33 %endif
34 34 </ul>
35 35 <!-- end user -->
36 36 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
37 37 <div id="logo">
38 38 <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
39 39 </div>
40 40 <!-- MENU -->
41 41 ${self.page_nav()}
42 42 <!-- END MENU -->
43 43 ${self.body()}
44 44 </div>
45 45 </div>
46 46 <!-- END HEADER -->
47 47
48 48 <!-- CONTENT -->
49 49 <div id="content">
50 50 <div class="flash_msg">
51 51 <% messages = h.flash.pop_messages() %>
52 52 % if messages:
53 53 <ul id="flash-messages">
54 54 % for message in messages:
55 55 <li class="${message.category}_msg">${message}</li>
56 56 % endfor
57 57 </ul>
58 58 % endif
59 59 </div>
60 60 <div id="main">
61 61 ${next.main()}
62 62 </div>
63 63 </div>
64 64 <!-- END CONTENT -->
65 65
66 66 <!-- FOOTER -->
67 67 <div id="footer">
68 68 <div id="footer-inner" class="title bottom-left-rounded-corner bottom-right-rounded-corner">
69 69 <div>
70 70 <p class="footer-link">
71 71 <a href="${h.url('bugtracker')}">${_('Submit a bug')}</a>
72 72 </p>
73 <p class="footer-link">
74 <a href="${h.url('gpl_license')}">${_('GPL license')}</a>
75 </p>
76 73 <p class="footer-link-right">
77 74 <a href="${h.url('rhodecode_official')}">RhodeCode</a>
78 75 ${c.rhodecode_version} &copy; 2010-${h.datetime.today().year} by Marcin Kuzminski
79 76 </p>
80 77 </div>
81 78 </div>
82 79 <script type="text/javascript">
83 80 function tooltip_activate(){
84 81 ${h.tooltip.activate()}
85 82 }
86 83 tooltip_activate();
87 84 </script>
88 85 </div>
89 86 <!-- END FOOTER -->
90 87
91 88 ### MAKO DEFS ###
92 89 <%def name="page_nav()">
93 90 ${self.menu()}
94 91 </%def>
95 92
96 93 <%def name="breadcrumbs()">
97 94 <div class="breadcrumbs">
98 95 ${self.breadcrumbs_links()}
99 96 </div>
100 97 </%def>
101 98
102 99
103 100 <%def name="menu(current=None)">
104 101 <%
105 102 def is_current(selected):
106 103 if selected == current:
107 104 return h.literal('class="current"')
108 105 %>
109 106 %if current not in ['home','admin']:
110 107 ##REGULAR MENU
111 108 <ul id="quick">
112 109 <!-- repo switcher -->
113 110 <li>
114 111 <a id="repo_switcher" title="${_('Switch repository')}" href="#">
115 112 <span class="icon">
116 113 <img src="${h.url("/images/icons/database.png")}" alt="${_('Products')}" />
117 114 </span>
118 115 <span>&darr;</span>
119 116 </a>
120 117 <ul id="repo_switcher_list" class="repo_switcher">
121 118 <li>
122 119 <a href="#">${_('loading...')}</a>
123 120 </li>
124 121 </ul>
125 122 <script type="text/javascript">
126 123 YUE.on('repo_switcher','mouseover',function(){
127 124 var loaded = YUD.hasClass('repo_switcher','loaded');
128 125 if(!loaded){
129 126 YUD.addClass('repo_switcher','loaded');
130 127 YAHOO.util.Connect.asyncRequest('GET',"${h.url('repo_switcher')}",{
131 128 success:function(o){
132 129 YUD.get('repo_switcher_list').innerHTML = o.responseText;
133 130 },
134 131 failure:function(o){
135 132 YUD.removeClass('repo_switcher','loaded');
136 133 }
137 134 },null);
138 135 }
139 136 return false;
140 137 });
141 138 </script>
142 139 </li>
143 140
144 141 <li ${is_current('summary')}>
145 142 <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
146 143 <span class="icon">
147 144 <img src="${h.url("/images/icons/clipboard_16.png")}" alt="${_('Summary')}" />
148 145 </span>
149 146 <span>${_('Summary')}</span>
150 147 </a>
151 148 </li>
152 149 ##<li ${is_current('shortlog')}>
153 150 ## <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}">
154 151 ## <span class="icon">
155 152 ## <img src="${h.url("/images/icons/application_view_list.png")}" alt="${_('Shortlog')}" />
156 153 ## </span>
157 154 ## <span>${_('Shortlog')}</span>
158 155 ## </a>
159 156 ##</li>
160 157 <li ${is_current('changelog')}>
161 158 <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}">
162 159 <span class="icon">
163 160 <img src="${h.url("/images/icons/time.png")}" alt="${_('Changelog')}" />
164 161 </span>
165 162 <span>${_('Changelog')}</span>
166 163 </a>
167 164 </li>
168 165
169 166 <li ${is_current('switch_to')}>
170 167 <a title="${_('Switch to')}" href="#">
171 168 <span class="icon">
172 169 <img src="${h.url("/images/icons/arrow_switch.png")}" alt="${_('Switch to')}" />
173 170 </span>
174 171 <span>${_('Switch to')}</span>
175 172 </a>
176 173 <ul>
177 174 <li>
178 175 ${h.link_to('%s (%s)' % (_('branches'),len(c.rhodecode_repo.branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
179 176 <ul>
180 177 %if c.rhodecode_repo.branches.values():
181 178 %for cnt,branch in enumerate(c.rhodecode_repo.branches.items()):
182 179 <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
183 180 %endfor
184 181 %else:
185 182 <li>${h.link_to(_('There are no branches yet'),'#')}</li>
186 183 %endif
187 184 </ul>
188 185 </li>
189 186 <li>
190 187 ${h.link_to('%s (%s)' % (_('tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
191 188 <ul>
192 189 %if c.rhodecode_repo.tags.values():
193 190 %for cnt,tag in enumerate(c.rhodecode_repo.tags.items()):
194 191 <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
195 192 %endfor
196 193 %else:
197 194 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
198 195 %endif
199 196 </ul>
200 197 </li>
201 198 </ul>
202 199 </li>
203 200 <li ${is_current('files')}>
204 201 <a title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}">
205 202 <span class="icon">
206 203 <img src="${h.url("/images/icons/file.png")}" alt="${_('Files')}" />
207 204 </span>
208 205 <span>${_('Files')}</span>
209 206 </a>
210 207 </li>
211 208
212 209 <li ${is_current('options')}>
213 210 <a title="${_('Options')}" href="#">
214 211 <span class="icon">
215 212 <img src="${h.url("/images/icons/table_gear.png")}" alt="${_('Admin')}" />
216 213 </span>
217 214 <span>${_('Options')}</span>
218 215 </a>
219 216 <ul>
220 217 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
221 218 %if h.HasPermissionAll('hg.admin')('access settings on repository'):
222 219 <li>${h.link_to(_('settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
223 220 %else:
224 221 <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
225 222 %endif
226 223 %endif
227 224 <li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li>
228 225 <li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li>
229 226
230 227 %if h.HasPermissionAll('hg.admin')('access admin main page'):
231 228 <li>
232 229 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
233 230 <%def name="admin_menu()">
234 231 <ul>
235 232 <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li>
236 233 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
237 234 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
238 235 <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
239 236 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
240 237 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
241 238 <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
242 239 </ul>
243 240 </%def>
244 241
245 242 ${admin_menu()}
246 243 </li>
247 244 %endif
248 245
249 246 </ul>
250 247 </li>
251 248
252 249 <li>
253 250 <a title="${_('Followers')}" href="#">
254 251 <span class="icon_short">
255 252 <img src="${h.url("/images/icons/heart.png")}" alt="${_('Followers')}" />
256 253 </span>
257 254 <span id="current_followers_count" class="short">${c.repository_followers}</span>
258 255 </a>
259 256 </li>
260 257 <li>
261 258 <a title="${_('Forks')}" href="#">
262 259 <span class="icon_short">
263 260 <img src="${h.url("/images/icons/arrow_divide.png")}" alt="${_('Forks')}" />
264 261 </span>
265 262 <span class="short">${c.repository_forks}</span>
266 263 </a>
267 264 </li>
268 265
269 266
270 267
271 268 </ul>
272 269 %else:
273 270 ##ROOT MENU
274 271 <ul id="quick">
275 272 <li>
276 273 <a title="${_('Home')}" href="${h.url('home')}">
277 274 <span class="icon">
278 275 <img src="${h.url("/images/icons/home_16.png")}" alt="${_('Home')}" />
279 276 </span>
280 277 <span>${_('Home')}</span>
281 278 </a>
282 279 </li>
283 280 %if c.rhodecode_user.username != 'default':
284 281 <li>
285 282 <a title="${_('Journal')}" href="${h.url('journal')}">
286 283 <span class="icon">
287 284 <img src="${h.url("/images/icons/book.png")}" alt="${_('Journal')}" />
288 285 </span>
289 286 <span>${_('Journal')}</span>
290 287 </a>
291 288 </li>
292 289 %endif
293 290 <li>
294 291 <a title="${_('Search')}" href="${h.url('search')}">
295 292 <span class="icon">
296 293 <img src="${h.url("/images/icons/search_16.png")}" alt="${_('Search')}" />
297 294 </span>
298 295 <span>${_('Search')}</span>
299 296 </a>
300 297 </li>
301 298
302 299 %if h.HasPermissionAll('hg.admin')('access admin main page'):
303 300 <li ${is_current('admin')}>
304 301 <a title="${_('Admin')}" href="${h.url('admin_home')}">
305 302 <span class="icon">
306 303 <img src="${h.url("/images/icons/cog_edit.png")}" alt="${_('Admin')}" />
307 304 </span>
308 305 <span>${_('Admin')}</span>
309 306 </a>
310 307 ${admin_menu()}
311 308 </li>
312 309 %endif
313 310 </ul>
314 311 %endif
315 312 </%def> No newline at end of file
@@ -1,49 +1,51 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.websetup
4 4 ~~~~~~~~~~~~~~~~~~
5 5
6 6 Weboperations and setup for rhodecode
7 7
8 8 :created_on: Dec 11, 2010
9 9 :author: marcink
10 10 :copyright: (C) 2009-2011 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
14 14 # modify it under the terms of the GNU General Public License
15 15 # as published by the Free Software Foundation; version 2
16 16 # of the License or (at your opinion) any later version of the license.
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, write to the Free Software
25 25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 26 # MA 02110-1301, USA.
27 27
28 28 import os
29 29 import logging
30 30
31 31 from rhodecode.config.environment import load_environment
32 32 from rhodecode.lib.db_manage import DbManage
33 33
34 34
35 35 log = logging.getLogger(__name__)
36 36
37
37 38 def setup_app(command, conf, vars):
38 39 """Place any commands to setup rhodecode here"""
39 40 dbconf = conf['sqlalchemy.db1.url']
40 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'], tests=False)
41 dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=conf['here'],
42 tests=False)
41 43 dbmanage.create_tables(override=True)
42 44 dbmanage.set_db_version()
43 45 dbmanage.create_settings(dbmanage.config_prompt(None))
44 46 dbmanage.create_default_user()
45 47 dbmanage.admin_prompt()
46 48 dbmanage.create_permissions()
47 49 dbmanage.populate_default_permissions()
48 50
49 51 load_environment(conf.global_conf, conf.local_conf, initial=True)
@@ -1,119 +1,119 b''
1 1 import sys
2 2 from rhodecode import get_version
3 3 from rhodecode import __platform__
4 from rhodecode import __license__
4 5
5 6 py_version = sys.version_info
6 7
7 8 if py_version < (2, 5):
8 9 raise Exception('RhodeCode requires python 2.5 or later')
9 10
10 11 requirements = [
11 12 "Pylons==1.0.0",
12 13 "WebHelpers>=1.2",
13 14 "SQLAlchemy>=0.6.6",
14 15 "Mako>=0.4.0",
15 16 "vcs>=0.2.0",
16 17 "pygments>=1.4",
17 18 "mercurial>=1.8.1",
18 19 "whoosh>=1.8.0",
19 20 "celery>=2.2.5",
20 21 "babel",
21 22 "python-dateutil>=1.5.0,<2.0.0",
22 23 ]
23 24
24 25 classifiers = ['Development Status :: 4 - Beta',
25 26 'Environment :: Web Environment',
26 27 'Framework :: Pylons',
27 28 'Intended Audience :: Developers',
28 'License :: OSI Approved :: BSD License',
29 29 'Operating System :: OS Independent',
30 30 'Programming Language :: Python',
31 31 'Programming Language :: Python :: 2.5',
32 32 'Programming Language :: Python :: 2.6',
33 33 'Programming Language :: Python :: 2.7', ]
34 34
35 35 if py_version < (2, 6):
36 36 requirements.append("simplejson")
37 37 requirements.append("pysqlite")
38 38
39 39 if __platform__ in ('Linux', 'Darwin'):
40 40 requirements.append("py-bcrypt")
41 41
42 42
43 43 #additional files from project that goes somewhere in the filesystem
44 44 #relative to sys.prefix
45 45 data_files = []
46 46
47 47 #additional files that goes into package itself
48 48 package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], }
49 49
50 50 description = ('Mercurial repository browser/management with '
51 51 'build in push/pull server and full text search')
52 52 keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git',
53 53 'repository management', 'hgweb replacement'
54 54 'hgwebdir', 'gitweb replacement', 'serving hgweb', ])
55 55 #long description
56 56 try:
57 57 readme_file = 'README.rst'
58 58 changelog_file = 'docs/changelog.rst'
59 59 long_description = open(readme_file).read() + '\n\n' + \
60 60 open(changelog_file).read()
61 61
62 62 except IOError, err:
63 63 sys.stderr.write("[WARNING] Cannot find file specified as "
64 64 "long_description (%s)\n or changelog (%s) skipping that file" \
65 65 % (readme_file, changelog_file))
66 66 long_description = description
67 67
68 68
69 69 try:
70 70 from setuptools import setup, find_packages
71 71 except ImportError:
72 72 from ez_setup import use_setuptools
73 73 use_setuptools()
74 74 from setuptools import setup, find_packages
75 75 #packages
76 76 packages = find_packages(exclude=['ez_setup'])
77 77
78 78 setup(
79 79 name='RhodeCode',
80 80 version=get_version(),
81 81 description=description,
82 82 long_description=long_description,
83 83 keywords=keywords,
84 license='GPLv3',
84 license=__license__,
85 85 author='Marcin Kuzminski',
86 86 author_email='marcin@python-works.com',
87 87 url='http://rhodecode.org',
88 88 install_requires=requirements,
89 89 classifiers=classifiers,
90 90 setup_requires=["PasteScript>=1.6.3"],
91 91 data_files=data_files,
92 92 packages=packages,
93 93 include_package_data=True,
94 94 test_suite='nose.collector',
95 95 package_data=package_data,
96 96 message_extractors={'rhodecode': [
97 97 ('**.py', 'python', None),
98 98 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
99 99 ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
100 100 ('public/**', 'ignore', None)]},
101 101 zip_safe=False,
102 102 paster_plugins=['PasteScript', 'Pylons'],
103 103 entry_points="""
104 104 [paste.app_factory]
105 105 main = rhodecode.config.middleware:make_app
106 106
107 107 [paste.app_install]
108 108 main = pylons.util:PylonsInstaller
109 109
110 110 [paste.global_paster_command]
111 111 make-index = rhodecode.lib.indexers:MakeIndex
112 112 upgrade-db = rhodecode.lib.dbmigrate:UpgradeDb
113 113 celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand
114 114 celerybeat=rhodecode.lib.celerypylons.commands:CeleryBeatCommand
115 115 camqadm=rhodecode.lib.celerypylons.commands:CAMQPAdminCommand
116 116 celeryev=rhodecode.lib.celerypylons.commands:CeleryEventCommand
117 117
118 118 """,
119 119 )
General Comments 0
You need to be logged in to leave comments. Login now