##// END OF EJS Templates
auto white-space removal
marcink -
r1818:cf51bbfb beta
parent child Browse files
Show More
@@ -137,7 +137,7 b' def make_map(config):'
137 m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*}",
137 m.connect('repo_as_fork', "/repo_as_fork/{repo_name:.*}",
138 action="repo_as_fork", conditions=dict(method=["PUT"],
138 action="repo_as_fork", conditions=dict(method=["PUT"],
139 function=check_repo))
139 function=check_repo))
140
140
141 with rmap.submapper(path_prefix=ADMIN_PREFIX,
141 with rmap.submapper(path_prefix=ADMIN_PREFIX,
142 controller='admin/repos_groups') as m:
142 controller='admin/repos_groups') as m:
143 m.connect("repos_groups", "/repos_groups",
143 m.connect("repos_groups", "/repos_groups",
@@ -21,7 +21,7 b' class NotificationsController(BaseContro'
21 """REST Controller styled on the Atom Publishing Protocol"""
21 """REST Controller styled on the Atom Publishing Protocol"""
22 # To properly map this controller, ensure your config/routing.py
22 # To properly map this controller, ensure your config/routing.py
23 # file has a resource setup:
23 # file has a resource setup:
24 # map.resource('notification', 'notifications', controller='_admin/notifications',
24 # map.resource('notification', 'notifications', controller='_admin/notifications',
25 # path_prefix='/_admin', name_prefix='_admin_')
25 # path_prefix='/_admin', name_prefix='_admin_')
26
26
27 @LoginRequired()
27 @LoginRequired()
@@ -112,7 +112,7 b' class ReposController(BaseController):'
112 c.repo_last_rev) * 100)
112 c.repo_last_rev) * 100)
113
113
114 defaults = RepoModel()._get_defaults(repo_name)
114 defaults = RepoModel()._get_defaults(repo_name)
115
115
116 c.repos_list = [('', _('--REMOVE FORK--'))]
116 c.repos_list = [('', _('--REMOVE FORK--'))]
117 c.repos_list += [(x.repo_id, x.repo_name) for x in
117 c.repos_list += [(x.repo_id, x.repo_name) for x in
118 Repository.query().order_by(Repository.repo_name).all()]
118 Repository.query().order_by(Repository.repo_name).all()]
@@ -393,7 +393,7 b' class ReposController(BaseController):'
393 def repo_as_fork(self, repo_name):
393 def repo_as_fork(self, repo_name):
394 """
394 """
395 Mark given repository as a fork of another
395 Mark given repository as a fork of another
396
396
397 :param repo_name:
397 :param repo_name:
398 """
398 """
399 try:
399 try:
@@ -402,7 +402,7 b' class ReposController(BaseController):'
402 self.rhodecode_user.username)
402 self.rhodecode_user.username)
403 fork = repo.fork.repo_name if repo.fork else _('Nothing')
403 fork = repo.fork.repo_name if repo.fork else _('Nothing')
404 Session.commit()
404 Session.commit()
405 h.flash(_('Marked repo %s as fork of %s' % (repo_name,fork)),
405 h.flash(_('Marked repo %s as fork of %s' % (repo_name,fork)),
406 category='success')
406 category='success')
407 except Exception, e:
407 except Exception, e:
408 raise
408 raise
@@ -226,5 +226,3 b' class ReposGroupsController(BaseControll'
226 encoding="UTF-8",
226 encoding="UTF-8",
227 force_defaults=False
227 force_defaults=False
228 )
228 )
229
230
@@ -188,7 +188,7 b' class UsersController(BaseController):'
188
188
189 grant_perm = request.POST.get('create_repo_perm', False)
189 grant_perm = request.POST.get('create_repo_perm', False)
190 user_model = UserModel()
190 user_model = UserModel()
191
191
192 if grant_perm:
192 if grant_perm:
193 perm = Permission.get_by_key('hg.create.none')
193 perm = Permission.get_by_key('hg.create.none')
194 user_model.revoke_perm(id, perm)
194 user_model.revoke_perm(id, perm)
@@ -113,9 +113,9 b' class UsersGroupsController(BaseControll'
113
113
114 c.available_members = [(x.user_id, x.username) for x in
114 c.available_members = [(x.user_id, x.username) for x in
115 self.sa.query(User).all()]
115 self.sa.query(User).all()]
116
116
117 available_members = [safe_unicode(x[0]) for x in c.available_members]
117 available_members = [safe_unicode(x[0]) for x in c.available_members]
118
118
119 users_group_form = UsersGroupForm(edit=True,
119 users_group_form = UsersGroupForm(edit=True,
120 old_data=c.users_group.get_dict(),
120 old_data=c.users_group.get_dict(),
121 available_members=available_members)()
121 available_members=available_members)()
@@ -210,7 +210,7 b' class UsersGroupsController(BaseControll'
210 UsersGroupModel().grant_perm(id, perm)
210 UsersGroupModel().grant_perm(id, perm)
211 h.flash(_("Granted 'repository create' permission to user"),
211 h.flash(_("Granted 'repository create' permission to user"),
212 category='success')
212 category='success')
213
213
214 Session.commit()
214 Session.commit()
215 else:
215 else:
216 perm = Permission.get_by_key('hg.create.repository')
216 perm = Permission.get_by_key('hg.create.repository')
@@ -7,19 +7,19 b''
7
7
8 :created_on: Aug 20, 2011
8 :created_on: Aug 20, 2011
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13 # This program is free software; you can redistribute it and/or
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; version 2
15 # as published by the Free Software Foundation; version 2
16 # of the License or (at your opinion) any later version of the license.
16 # of the License or (at your opinion) any later version of the license.
17 #
17 #
18 # This program is distributed in the hope that it will be useful,
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
@@ -226,7 +226,7 b' class JSONRPCController(WSGIController):'
226 if self._error is not None:
226 if self._error is not None:
227 raw_response = None
227 raw_response = None
228
228
229 response = dict(id=self._req_id, result=raw_response,
229 response = dict(id=self._req_id, result=raw_response,
230 error=self._error)
230 error=self._error)
231
231
232 try:
232 try:
@@ -259,4 +259,3 b' class JSONRPCController(WSGIController):'
259 return func
259 return func
260 else:
260 else:
261 raise AttributeError("No such method: %s" % self._req_method)
261 raise AttributeError("No such method: %s" % self._req_method)
262
@@ -45,7 +45,7 b' class BookmarksController(BaseRepoContro'
45 def index(self):
45 def index(self):
46 if c.rhodecode_repo.alias != 'hg':
46 if c.rhodecode_repo.alias != 'hg':
47 raise HTTPNotFound()
47 raise HTTPNotFound()
48
48
49 c.repo_bookmarks = OrderedDict()
49 c.repo_bookmarks = OrderedDict()
50
50
51 bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \
51 bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \
@@ -71,21 +71,21 b' class ChangelogController(BaseRepoContro'
71 branch_name = request.params.get('branch', None)
71 branch_name = request.params.get('branch', None)
72 try:
72 try:
73 if branch_name:
73 if branch_name:
74 collection = [z for z in
74 collection = [z for z in
75 c.rhodecode_repo.get_changesets(start=0,
75 c.rhodecode_repo.get_changesets(start=0,
76 branch_name=branch_name)]
76 branch_name=branch_name)]
77 c.total_cs = len(collection)
77 c.total_cs = len(collection)
78 else:
78 else:
79 collection = list(c.rhodecode_repo)
79 collection = list(c.rhodecode_repo)
80 c.total_cs = len(c.rhodecode_repo)
80 c.total_cs = len(c.rhodecode_repo)
81
81
82
82
83 c.pagination = RepoPage(collection, page=p, item_count=c.total_cs,
83 c.pagination = RepoPage(collection, page=p, item_count=c.total_cs,
84 items_per_page=c.size, branch=branch_name)
84 items_per_page=c.size, branch=branch_name)
85 except (RepositoryError, ChangesetDoesNotExistError, Exception), e:
85 except (RepositoryError, ChangesetDoesNotExistError, Exception), e:
86 log.error(traceback.format_exc())
86 log.error(traceback.format_exc())
87 h.flash(str(e), category='warning')
87 h.flash(str(e), category='warning')
88 return redirect(url('home'))
88 return redirect(url('home'))
89
89
90 self._graph(c.rhodecode_repo, collection, c.total_cs, c.size, p)
90 self._graph(c.rhodecode_repo, collection, c.total_cs, c.size, p)
91
91
@@ -139,4 +139,3 b' class ChangelogController(BaseRepoContro'
139 data.append(['', vtx, edges])
139 data.append(['', vtx, edges])
140
140
141 c.jsdata = json.dumps(data)
141 c.jsdata = json.dumps(data)
142
@@ -417,7 +417,7 b' class FilesController(BaseRepoController'
417 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
417 c.changeset_2 = EmptyChangeset(repo=c.rhodecode_repo)
418 node2 = FileNode('.', '', changeset=c.changeset_2)
418 node2 = FileNode('.', '', changeset=c.changeset_2)
419 except RepositoryError:
419 except RepositoryError:
420 return redirect(url('files_home', repo_name=c.repo_name,
420 return redirect(url('files_home', repo_name=c.repo_name,
421 f_path=f_path))
421 f_path=f_path))
422
422
423 if c.action == 'download':
423 if c.action == 'download':
@@ -490,4 +490,3 b' class FilesController(BaseRepoController'
490 _d, _f = ScmModel().get_nodes(repo_name, cs.raw_id, f_path,
490 _d, _f = ScmModel().get_nodes(repo_name, cs.raw_id, f_path,
491 flat=False)
491 flat=False)
492 return _d + _f
492 return _d + _f
493
@@ -66,4 +66,3 b' class HomeController(BaseController):'
66 return render('/switch_to_list.html')
66 return render('/switch_to_list.html')
67 else:
67 else:
68 return HTTPBadRequest()
68 return HTTPBadRequest()
69
@@ -81,7 +81,7 b' class LoginController(BaseController):'
81 'session, session attrs %s' % (username, cs))
81 'session, session attrs %s' % (username, cs))
82 user.update_lastlogin()
82 user.update_lastlogin()
83 Session.commit()
83 Session.commit()
84
84
85 if c.came_from:
85 if c.came_from:
86 return redirect(c.came_from)
86 return redirect(c.came_from)
87 else:
87 else:
@@ -233,4 +233,3 b' class SummaryController(BaseRepoControll'
233 download_l.append(tags_group)
233 download_l.append(tags_group)
234
234
235 return download_l
235 return download_l
236
@@ -116,12 +116,12 b' def str2bool(_str):'
116 def convert_line_endings(line, mode):
116 def convert_line_endings(line, mode):
117 """
117 """
118 Converts a given line "line end" accordingly to given mode
118 Converts a given line "line end" accordingly to given mode
119
119
120 Available modes are::
120 Available modes are::
121 0 - Unix
121 0 - Unix
122 1 - Mac
122 1 - Mac
123 2 - DOS
123 2 - DOS
124
124
125 :param line: given line to convert
125 :param line: given line to convert
126 :param mode: mode to convert to
126 :param mode: mode to convert to
127 :rtype: str
127 :rtype: str
@@ -183,7 +183,7 b' def generate_api_key(username, salt=None'
183 def safe_unicode(str_, from_encoding='utf8'):
183 def safe_unicode(str_, from_encoding='utf8'):
184 """
184 """
185 safe unicode function. Does few trick to turn str_ into unicode
185 safe unicode function. Does few trick to turn str_ into unicode
186
186
187 In case of UnicodeDecode error we try to return it with encoding detected
187 In case of UnicodeDecode error we try to return it with encoding detected
188 by chardet library if it fails fallback to unicode with errors replaced
188 by chardet library if it fails fallback to unicode with errors replaced
189
189
@@ -216,7 +216,7 b" def safe_unicode(str_, from_encoding='ut"
216 def safe_str(unicode_, to_encoding='utf8'):
216 def safe_str(unicode_, to_encoding='utf8'):
217 """
217 """
218 safe str function. Does few trick to turn unicode_ into string
218 safe str function. Does few trick to turn unicode_ into string
219
219
220 In case of UnicodeEncodeError we try to return it with encoding detected
220 In case of UnicodeEncodeError we try to return it with encoding detected
221 by chardet library if it fails fallback to string with errors replaced
221 by chardet library if it fails fallback to string with errors replaced
222
222
@@ -254,7 +254,7 b" def safe_str(unicode_, to_encoding='utf8"
254 def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs):
254 def engine_from_config(configuration, prefix='sqlalchemy.', **kwargs):
255 """
255 """
256 Custom engine_from_config functions that makes sure we use NullPool for
256 Custom engine_from_config functions that makes sure we use NullPool for
257 file based sqlite databases. This prevents errors on sqlite. This only
257 file based sqlite databases. This prevents errors on sqlite. This only
258 applies to sqlalchemy versions < 0.7.0
258 applies to sqlalchemy versions < 0.7.0
259
259
260 """
260 """
@@ -313,7 +313,7 b' def engine_from_config(configuration, pr'
313 def age(curdate):
313 def age(curdate):
314 """
314 """
315 turns a datetime into an age string.
315 turns a datetime into an age string.
316
316
317 :param curdate: datetime object
317 :param curdate: datetime object
318 :rtype: unicode
318 :rtype: unicode
319 :returns: unicode words describing age
319 :returns: unicode words describing age
@@ -350,10 +350,10 b' def age(curdate):'
350 def uri_filter(uri):
350 def uri_filter(uri):
351 """
351 """
352 Removes user:password from given url string
352 Removes user:password from given url string
353
353
354 :param uri:
354 :param uri:
355 :rtype: unicode
355 :rtype: unicode
356 :returns: filtered list of strings
356 :returns: filtered list of strings
357 """
357 """
358 if not uri:
358 if not uri:
359 return ''
359 return ''
@@ -382,7 +382,7 b' def uri_filter(uri):'
382 def credentials_filter(uri):
382 def credentials_filter(uri):
383 """
383 """
384 Returns a url with removed credentials
384 Returns a url with removed credentials
385
385
386 :param uri:
386 :param uri:
387 """
387 """
388
388
@@ -395,9 +395,9 b' def credentials_filter(uri):'
395
395
396 def get_changeset_safe(repo, rev):
396 def get_changeset_safe(repo, rev):
397 """
397 """
398 Safe version of get_changeset if this changeset doesn't exists for a
398 Safe version of get_changeset if this changeset doesn't exists for a
399 repo it returns a Dummy one instead
399 repo it returns a Dummy one instead
400
400
401 :param repo:
401 :param repo:
402 :param rev:
402 :param rev:
403 """
403 """
@@ -419,7 +419,7 b' def get_current_revision(quiet=False):'
419 """
419 """
420 Returns tuple of (number, id) from repository containing this package
420 Returns tuple of (number, id) from repository containing this package
421 or None if repository could not be found.
421 or None if repository could not be found.
422
422
423 :param quiet: prints error for fetching revision if True
423 :param quiet: prints error for fetching revision if True
424 """
424 """
425
425
@@ -440,7 +440,7 b' def get_current_revision(quiet=False):'
440 def extract_mentioned_users(s):
440 def extract_mentioned_users(s):
441 """
441 """
442 Returns unique usernames from given string s that have @mention
442 Returns unique usernames from given string s that have @mention
443
443
444 :param s: string to get mentions
444 :param s: string to get mentions
445 """
445 """
446 usrs = {}
446 usrs = {}
@@ -4,10 +4,10 b''
4 ~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Anontation library for usage in rhodecode, previously part of vcs
6 Anontation library for usage in rhodecode, previously part of vcs
7
7
8 :created_on: Dec 4, 2011
8 :created_on: Dec 4, 2011
9 :author: marcink
9 :author: marcink
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
12 """
12 """
13
13
@@ -56,7 +56,7 b' log = logging.getLogger(__name__)'
56
56
57 class PasswordGenerator(object):
57 class PasswordGenerator(object):
58 """
58 """
59 This is a simple class for generating password from different sets of
59 This is a simple class for generating password from different sets of
60 characters
60 characters
61 usage::
61 usage::
62
62
@@ -131,7 +131,7 b' def check_password(password, hashed):'
131 def generate_api_key(str_, salt=None):
131 def generate_api_key(str_, salt=None):
132 """
132 """
133 Generates API KEY from given string
133 Generates API KEY from given string
134
134
135 :param str_:
135 :param str_:
136 :param salt:
136 :param salt:
137 """
137 """
@@ -144,7 +144,7 b' def generate_api_key(str_, salt=None):'
144
144
145 def authfunc(environ, username, password):
145 def authfunc(environ, username, password):
146 """
146 """
147 Dummy authentication wrapper function used in Mercurial and Git for
147 Dummy authentication wrapper function used in Mercurial and Git for
148 access control.
148 access control.
149
149
150 :param environ: needed only for using in Basic auth
150 :param environ: needed only for using in Basic auth
@@ -226,8 +226,8 b' def authenticate(username, password):'
226 if user_model.create_ldap(username, password, user_dn,
226 if user_model.create_ldap(username, password, user_dn,
227 user_attrs):
227 user_attrs):
228 log.info('created new ldap user %s', username)
228 log.info('created new ldap user %s', username)
229
229
230 Session.commit()
230 Session.commit()
231 return True
231 return True
232 except (LdapUsernameError, LdapPasswordError,):
232 except (LdapUsernameError, LdapPasswordError,):
233 pass
233 pass
@@ -254,7 +254,7 b' def login_container_auth(username):'
254
254
255 user.update_lastlogin()
255 user.update_lastlogin()
256 Session.commit()
256 Session.commit()
257
257
258 log.debug('User %s is now logged in by container authentication',
258 log.debug('User %s is now logged in by container authentication',
259 user.username)
259 user.username)
260 return user
260 return user
@@ -311,7 +311,7 b' class AuthUser(object):'
311 if self._api_key and self._api_key != self.anonymous_user.api_key:
311 if self._api_key and self._api_key != self.anonymous_user.api_key:
312 log.debug('Auth User lookup by API KEY %s', self._api_key)
312 log.debug('Auth User lookup by API KEY %s', self._api_key)
313 is_user_loaded = user_model.fill_data(self, api_key=self._api_key)
313 is_user_loaded = user_model.fill_data(self, api_key=self._api_key)
314 # lookup by userid
314 # lookup by userid
315 elif (self.user_id is not None and
315 elif (self.user_id is not None and
316 self.user_id != self.anonymous_user.user_id):
316 self.user_id != self.anonymous_user.user_id):
317 log.debug('Auth User lookup by USER ID %s', self.user_id)
317 log.debug('Auth User lookup by USER ID %s', self.user_id)
@@ -319,7 +319,7 b' class AuthUser(object):'
319 # lookup by username
319 # lookup by username
320 elif self.username and \
320 elif self.username and \
321 str2bool(config.get('container_auth_enabled', False)):
321 str2bool(config.get('container_auth_enabled', False)):
322
322
323 log.debug('Auth User lookup by USER NAME %s', self.username)
323 log.debug('Auth User lookup by USER NAME %s', self.username)
324 dbuser = login_container_auth(self.username)
324 dbuser = login_container_auth(self.username)
325 if dbuser is not None:
325 if dbuser is not None:
@@ -696,4 +696,3 b' class HasPermissionAnyMiddleware(object)'
696 return True
696 return True
697 log.debug('permission denied')
697 log.debug('permission denied')
698 return False
698 return False
699
@@ -3,7 +3,7 b''
3 rhodecode.lib.backup_manager
3 rhodecode.lib.backup_manager
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Mercurial repositories backup manager, it allows to backups all
6 Mercurial repositories backup manager, it allows to backups all
7 repositories and send it to backup server using RSA key via ssh.
7 repositories and send it to backup server using RSA key via ssh.
8
8
9 :created_on: Feb 28, 2010
9 :created_on: Feb 28, 2010
@@ -175,4 +175,3 b' class BaseRepoController(BaseController)'
175
175
176 c.repository_followers = self.scm_model.get_followers(c.repo_name)
176 c.repository_followers = self.scm_model.get_followers(c.repo_name)
177 c.repository_forks = self.scm_model.get_forks(c.repo_name)
177 c.repository_forks = self.scm_model.get_forks(c.repo_name)
178
@@ -114,7 +114,7 b' def get_commits_stats(repo_name, ts_min_'
114 repo = Repository.get_by_repo_name(repo_name)
114 repo = Repository.get_by_repo_name(repo_name)
115 if repo is None:
115 if repo is None:
116 return True
116 return True
117
117
118 repo = repo.scm_instance
118 repo = repo.scm_instance
119 repo_size = repo.count()
119 repo_size = repo.count()
120 # return if repo have no revisions
120 # return if repo have no revisions
@@ -364,7 +364,7 b' def send_email(recipients, subject, body'
364 def create_repo_fork(form_data, cur_user):
364 def create_repo_fork(form_data, cur_user):
365 """
365 """
366 Creates a fork of repository using interval VCS methods
366 Creates a fork of repository using interval VCS methods
367
367
368 :param form_data:
368 :param form_data:
369 :param cur_user:
369 :param cur_user:
370 """
370 """
@@ -392,9 +392,9 b' def create_repo_fork(form_data, cur_user'
392 update_after_clone=update_after_clone)
392 update_after_clone=update_after_clone)
393 action_logger(cur_user, 'user_forked_repo:%s' % fork_name,
393 action_logger(cur_user, 'user_forked_repo:%s' % fork_name,
394 org_repo_name, '', Session)
394 org_repo_name, '', Session)
395
395
396 action_logger(cur_user, 'user_created_fork:%s' % fork_name,
396 action_logger(cur_user, 'user_created_fork:%s' % fork_name,
397 fork_name, '', Session)
397 fork_name, '', Session)
398 # finally commit at latest possible stage
398 # finally commit at latest possible stage
399 Session.commit()
399 Session.commit()
400
400
@@ -4,11 +4,11 b''
4 ~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~
5
5
6 Python backward compatibility functions and common libs
6 Python backward compatibility functions and common libs
7
7
8
8
9 :created_on: Oct 7, 2011
9 :created_on: Oct 7, 2011
10 :author: marcink
10 :author: marcink
11 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
11 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
12 :license: GPLv3, see COPYING for more details.
13 """
13 """
14 # This program is free software: you can redistribute it and/or modify
14 # This program is free software: you can redistribute it and/or modify
@@ -90,7 +90,7 b' class _Nil(object):'
90 class _odict(object):
90 class _odict(object):
91 """Ordered dict data structure, with O(1) complexity for dict operations
91 """Ordered dict data structure, with O(1) complexity for dict operations
92 that modify one element.
92 that modify one element.
93
93
94 Overwriting values doesn't change their original sequential order.
94 Overwriting values doesn't change their original sequential order.
95 """
95 """
96
96
@@ -8,4 +8,4 b''
8 from rhodecode.lib.dbmigrate.migrate.versioning import *
8 from rhodecode.lib.dbmigrate.migrate.versioning import *
9 from rhodecode.lib.dbmigrate.migrate.changeset import *
9 from rhodecode.lib.dbmigrate.migrate.changeset import *
10
10
11 __version__ = '0.7.3.dev' No newline at end of file
11 __version__ = '0.7.3.dev'
@@ -12,7 +12,7 b' from sqlalchemy import __version__ as _s'
12
12
13 warnings.simplefilter('always', DeprecationWarning)
13 warnings.simplefilter('always', DeprecationWarning)
14
14
15 _sa_version = tuple(int(re.match("\d+", x).group(0))
15 _sa_version = tuple(int(re.match("\d+", x).group(0))
16 for x in _sa_version.split("."))
16 for x in _sa_version.split("."))
17 SQLA_06 = _sa_version >= (0, 6)
17 SQLA_06 = _sa_version >= (0, 6)
18 SQLA_07 = _sa_version >= (0, 7)
18 SQLA_07 = _sa_version >= (0, 7)
@@ -282,4 +282,3 b' class ModelGenerator(object):'
282 except:
282 except:
283 trans.rollback()
283 trans.rollback()
284 raise
284 raise
285
@@ -153,7 +153,7 b' class Repository(pathed.Pathed):'
153
153
154 def create_script(self, description, **k):
154 def create_script(self, description, **k):
155 """API to :meth:`migrate.versioning.version.Collection.create_new_python_version`"""
155 """API to :meth:`migrate.versioning.version.Collection.create_new_python_version`"""
156
156
157 k['use_timestamp_numbering'] = self.use_timestamp_numbering
157 k['use_timestamp_numbering'] = self.use_timestamp_numbering
158 self.versions.create_new_python_version(description, **k)
158 self.versions.create_new_python_version(description, **k)
159
159
@@ -60,7 +60,7 b' class Collection(pathed.Pathed):'
60 and store them in self.versions
60 and store them in self.versions
61 """
61 """
62 super(Collection, self).__init__(path)
62 super(Collection, self).__init__(path)
63
63
64 # Create temporary list of files, allowing skipped version numbers.
64 # Create temporary list of files, allowing skipped version numbers.
65 files = os.listdir(path)
65 files = os.listdir(path)
66 if '1' in files:
66 if '1' in files:
@@ -111,7 +111,7 b' class Collection(pathed.Pathed):'
111
111
112 script.PythonScript.create(filepath, **k)
112 script.PythonScript.create(filepath, **k)
113 self.versions[ver] = Version(ver, self.path, [filename])
113 self.versions[ver] = Version(ver, self.path, [filename])
114
114
115 def create_new_sql_version(self, database, description, **k):
115 def create_new_sql_version(self, database, description, **k):
116 """Create SQL files for new version"""
116 """Create SQL files for new version"""
117 ver = self._next_ver_num(k.pop('use_timestamp_numbering', False))
117 ver = self._next_ver_num(k.pop('use_timestamp_numbering', False))
@@ -131,7 +131,7 b' class Collection(pathed.Pathed):'
131 filepath = self._version_path(filename)
131 filepath = self._version_path(filename)
132 script.SqlScript.create(filepath, **k)
132 script.SqlScript.create(filepath, **k)
133 self.versions[ver].add_script(filepath)
133 self.versions[ver].add_script(filepath)
134
134
135 def version(self, vernum=None):
135 def version(self, vernum=None):
136 """Returns latest Version if vernum is not given.
136 """Returns latest Version if vernum is not given.
137 Otherwise, returns wanted version"""
137 Otherwise, returns wanted version"""
@@ -150,7 +150,7 b' class Collection(pathed.Pathed):'
150
150
151 class Version(object):
151 class Version(object):
152 """A single version in a collection
152 """A single version in a collection
153 :param vernum: Version Number
153 :param vernum: Version Number
154 :param path: Path to script files
154 :param path: Path to script files
155 :param filelist: List of scripts
155 :param filelist: List of scripts
156 :type vernum: int, VerNum
156 :type vernum: int, VerNum
@@ -167,7 +167,7 b' class Version(object):'
167
167
168 for script in filelist:
168 for script in filelist:
169 self.add_script(os.path.join(path, script))
169 self.add_script(os.path.join(path, script))
170
170
171 def script(self, database=None, operation=None):
171 def script(self, database=None, operation=None):
172 """Returns SQL or Python Script"""
172 """Returns SQL or Python Script"""
173 for db in (database, 'default'):
173 for db in (database, 'default'):
@@ -196,7 +196,7 b' class Version(object):'
196 def _add_script_sql(self, path):
196 def _add_script_sql(self, path):
197 basename = os.path.basename(path)
197 basename = os.path.basename(path)
198 match = self.SQL_FILENAME.match(basename)
198 match = self.SQL_FILENAME.match(basename)
199
199
200 if match:
200 if match:
201 basename = basename.replace('.sql', '')
201 basename = basename.replace('.sql', '')
202 parts = basename.split('_')
202 parts = basename.split('_')
@@ -5,10 +5,10 b''
5
5
6
6
7 Schemas for migrations
7 Schemas for migrations
8
8
9
9
10 :created_on: Nov 1, 2011
10 :created_on: Nov 1, 2011
11 :author: marcink
11 :author: marcink
12 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
12 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
13 :license: <name>, see LICENSE_FILE for more details.
13 :license: <name>, see LICENSE_FILE for more details.
14 """
14 """
@@ -91,4 +91,4 b' class CacheInvalidation(Base, BaseModel)'
91 self.cache_active = False
91 self.cache_active = False
92
92
93 def __repr__(self):
93 def __repr__(self):
94 return "<CacheInvalidation('%s:%s')>" % (self.cache_id, self.cache_key) No newline at end of file
94 return "<CacheInvalidation('%s:%s')>" % (self.cache_id, self.cache_key)
@@ -1044,7 +1044,7 b' class CacheInvalidation(Base, BaseModel)'
1044 Returns Invalidation object if this given key should be invalidated
1044 Returns Invalidation object if this given key should be invalidated
1045 None otherwise. `cache_active = False` means that this cache
1045 None otherwise. `cache_active = False` means that this cache
1046 state is not valid and needs to be invalidated
1046 state is not valid and needs to be invalidated
1047
1047
1048 :param key:
1048 :param key:
1049 """
1049 """
1050 return cls.query()\
1050 return cls.query()\
@@ -1056,7 +1056,7 b' class CacheInvalidation(Base, BaseModel)'
1056 def set_invalidate(cls, key):
1056 def set_invalidate(cls, key):
1057 """
1057 """
1058 Mark this Cache key for invalidation
1058 Mark this Cache key for invalidation
1059
1059
1060 :param key:
1060 :param key:
1061 """
1061 """
1062
1062
@@ -1080,7 +1080,7 b' class CacheInvalidation(Base, BaseModel)'
1080 def set_valid(cls, key):
1080 def set_valid(cls, key):
1081 """
1081 """
1082 Mark this cache key as active and currently cached
1082 Mark this cache key as active and currently cached
1083
1083
1084 :param key:
1084 :param key:
1085 """
1085 """
1086 inv_obj = Session.query(CacheInvalidation)\
1086 inv_obj = Session.query(CacheInvalidation)\
@@ -1095,4 +1095,3 b' class DbMigrateVersion(Base, BaseModel):'
1095 repository_id = Column('repository_id', String(250), primary_key=True)
1095 repository_id = Column('repository_id', String(250), primary_key=True)
1096 repository_path = Column('repository_path', Text)
1096 repository_path = Column('repository_path', Text)
1097 version = Column('version', Integer)
1097 version = Column('version', Integer)
1098
@@ -21,4 +21,4 b''
21 # GNU General Public License for more details.
21 # GNU General Public License for more details.
22 #
22 #
23 # You should have received a copy of the GNU General Public License
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. No newline at end of file
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -71,7 +71,7 b' def upgrade(migrate_engine):'
71 #==========================================================================
71 #==========================================================================
72 from rhodecode.lib.dbmigrate.schema.db_1_1_0 import UserFollowing
72 from rhodecode.lib.dbmigrate.schema.db_1_1_0 import UserFollowing
73 UserFollowing().__table__.create()
73 UserFollowing().__table__.create()
74
74
75 #==========================================================================
75 #==========================================================================
76 # Add table `cache_invalidation`
76 # Add table `cache_invalidation`
77 #==========================================================================
77 #==========================================================================
@@ -83,7 +83,7 b' def upgrade(migrate_engine):'
83 nullable=True, unique=False, default=None)
83 nullable=True, unique=False, default=None)
84
84
85 clone_uri.create(Repository().__table__)
85 clone_uri.create(Repository().__table__)
86
86
87 #ADD downloads column#
87 #ADD downloads column#
88 enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True)
88 enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True)
89 enable_downloads.create(Repository().__table__)
89 enable_downloads.create(Repository().__table__)
@@ -106,8 +106,8 b' def upgrade(migrate_engine):'
106
106
107 from rhodecode.lib.dbmigrate.schema.db_1_2_0 import UserFollowing
107 from rhodecode.lib.dbmigrate.schema.db_1_2_0 import UserFollowing
108
108
109 follows_from = Column('follows_from', DateTime(timezone=False),
109 follows_from = Column('follows_from', DateTime(timezone=False),
110 nullable=True, unique=None,
110 nullable=True, unique=None,
111 default=datetime.datetime.now)
111 default=datetime.datetime.now)
112 follows_from.create(UserFollowing().__table__)
112 follows_from.create(UserFollowing().__table__)
113
113
@@ -18,7 +18,7 b' def upgrade(migrate_engine):'
18 Don't create your own engine; bind migrate_engine to your metadata
18 Don't create your own engine; bind migrate_engine to your metadata
19 """
19 """
20
20
21
21
22
22
23 return
23 return
24
24
@@ -585,7 +585,7 b' class RepoPage(Page):'
585 self.items_per_page))
585 self.items_per_page))
586 self.last_page = self.first_page + self.page_count - 1
586 self.last_page = self.first_page + self.page_count - 1
587
587
588 # Make sure that the requested page number is the range of
588 # Make sure that the requested page number is the range of
589 # valid pages
589 # valid pages
590 if self.page > self.last_page:
590 if self.page > self.last_page:
591 self.page = self.last_page
591 self.page = self.last_page
@@ -632,7 +632,7 b' def changed_tooltip(nodes):'
632 """
632 """
633 Generates a html string for changed nodes in changeset page.
633 Generates a html string for changed nodes in changeset page.
634 It limits the output to 30 entries
634 It limits the output to 30 entries
635
635
636 :param nodes: LazyNodesGenerator
636 :param nodes: LazyNodesGenerator
637 """
637 """
638 if nodes:
638 if nodes:
@@ -651,10 +651,10 b' def repo_link(groups_and_repos):'
651 """
651 """
652 Makes a breadcrumbs link to repo within a group
652 Makes a breadcrumbs link to repo within a group
653 joins &raquo; on each group to create a fancy link
653 joins &raquo; on each group to create a fancy link
654
654
655 ex::
655 ex::
656 group >> subgroup >> repo
656 group >> subgroup >> repo
657
657
658 :param groups_and_repos:
658 :param groups_and_repos:
659 """
659 """
660 groups, repo_name = groups_and_repos
660 groups, repo_name = groups_and_repos
@@ -672,7 +672,7 b' def fancy_file_stats(stats):'
672 """
672 """
673 Displays a fancy two colored bar for number of added/deleted
673 Displays a fancy two colored bar for number of added/deleted
674 lines of code on file
674 lines of code on file
675
675
676 :param stats: two element list of added/deleted lines of code
676 :param stats: two element list of added/deleted lines of code
677 """
677 """
678
678
@@ -745,7 +745,7 b' def rst(source):'
745 def rst_w_mentions(source):
745 def rst_w_mentions(source):
746 """
746 """
747 Wrapped rst renderer with @mention highlighting
747 Wrapped rst renderer with @mention highlighting
748
748
749 :param source:
749 :param source:
750 """
750 """
751 return literal('<div class="rst-block">%s</div>' %
751 return literal('<div class="rst-block">%s</div>' %
@@ -3,9 +3,9 b''
3 rhodecode.lib.markup_renderer
3 rhodecode.lib.markup_renderer
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6
6
7 Renderer for markup languages with ability to parse using rst or markdown
7 Renderer for markup languages with ability to parse using rst or markdown
8
8
9 :created_on: Oct 27, 2011
9 :created_on: Oct 27, 2011
10 :author: marcink
10 :author: marcink
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
@@ -33,18 +33,18 b' log = logging.getLogger(__name__)'
33
33
34 class MarkupRenderer(object):
34 class MarkupRenderer(object):
35 RESTRUCTUREDTEXT_DISALLOWED_DIRECTIVES = ['include', 'meta', 'raw']
35 RESTRUCTUREDTEXT_DISALLOWED_DIRECTIVES = ['include', 'meta', 'raw']
36
36
37 MARKDOWN_PAT = re.compile(r'md|mkdn?|mdown|markdown',re.IGNORECASE)
37 MARKDOWN_PAT = re.compile(r'md|mkdn?|mdown|markdown',re.IGNORECASE)
38 RST_PAT = re.compile(r're?st',re.IGNORECASE)
38 RST_PAT = re.compile(r're?st',re.IGNORECASE)
39 PLAIN_PAT = re.compile(r'readme',re.IGNORECASE)
39 PLAIN_PAT = re.compile(r'readme',re.IGNORECASE)
40
40
41 def __detect_renderer(self, source, filename=None):
41 def __detect_renderer(self, source, filename=None):
42 """
42 """
43 runs detection of what renderer should be used for generating html
43 runs detection of what renderer should be used for generating html
44 from a markup language
44 from a markup language
45
45
46 filename can be also explicitly a renderer name
46 filename can be also explicitly a renderer name
47
47
48 :param source:
48 :param source:
49 :param filename:
49 :param filename:
50 """
50 """
@@ -66,7 +66,7 b' class MarkupRenderer(object):'
66 Renders a given filename using detected renderer
66 Renders a given filename using detected renderer
67 it detects renderers based on file extension or mimetype.
67 it detects renderers based on file extension or mimetype.
68 At last it will just do a simple html replacing new lines with <br/>
68 At last it will just do a simple html replacing new lines with <br/>
69
69
70 :param file_name:
70 :param file_name:
71 :param source:
71 :param source:
72 """
72 """
@@ -130,10 +130,9 b' class MarkupRenderer(object):'
130 @classmethod
130 @classmethod
131 def rst_with_mentions(cls, source):
131 def rst_with_mentions(cls, source):
132 mention_pat = re.compile(r'(?:^@|\s@)(\w+)')
132 mention_pat = re.compile(r'(?:^@|\s@)(\w+)')
133
133
134 def wrapp(match_obj):
134 def wrapp(match_obj):
135 uname = match_obj.groups()[0]
135 uname = match_obj.groups()[0]
136 return ' **@%(uname)s** ' % {'uname':uname}
136 return ' **@%(uname)s** ' % {'uname':uname}
137 mention_hl = mention_pat.sub(wrapp, source).strip()
137 mention_hl = mention_pat.sub(wrapp, source).strip()
138 return cls.rst(mention_hl)
138 return cls.rst(mention_hl)
139
@@ -161,7 +161,7 b' class SimpleGit(BaseVCSController):'
161 try:
161 try:
162 user = self.__get_user(username)
162 user = self.__get_user(username)
163 if user is None or not user.active:
163 if user is None or not user.active:
164 return HTTPForbidden()(environ, start_response)
164 return HTTPForbidden()(environ, start_response)
165 username = user.username
165 username = user.username
166 except:
166 except:
167 log.error(traceback.format_exc())
167 log.error(traceback.format_exc())
@@ -199,7 +199,7 b' class SimpleGit(BaseVCSController):'
199 def __make_app(self, repo_name, repo_path):
199 def __make_app(self, repo_name, repo_path):
200 """
200 """
201 Make an wsgi application using dulserver
201 Make an wsgi application using dulserver
202
202
203 :param repo_name: name of the repository
203 :param repo_name: name of the repository
204 :param repo_path: full path to the repository
204 :param repo_path: full path to the repository
205 """
205 """
@@ -225,9 +225,9 b' class SimpleHg(BaseVCSController):'
225 def __inject_extras(self, repo_path, baseui, extras={}):
225 def __inject_extras(self, repo_path, baseui, extras={}):
226 """
226 """
227 Injects some extra params into baseui instance
227 Injects some extra params into baseui instance
228
228
229 also overwrites global settings with those takes from local hgrc file
229 also overwrites global settings with those takes from local hgrc file
230
230
231 :param baseui: baseui instance
231 :param baseui: baseui instance
232 :param extras: dict with extra params to put into baseui
232 :param extras: dict with extra params to put into baseui
233 """
233 """
@@ -249,4 +249,3 b' class SimpleHg(BaseVCSController):'
249 for section in ui_sections:
249 for section in ui_sections:
250 for k, v in repoui.configitems(section):
250 for k, v in repoui.configitems(section):
251 baseui.setconfig(section, k, v)
251 baseui.setconfig(section, k, v)
252
@@ -5,7 +5,7 b' class InvalidMessage(RuntimeError):'
5 as recipients or sender address.
5 as recipients or sender address.
6 """
6 """
7
7
8 class BadHeaders(RuntimeError):
8 class BadHeaders(RuntimeError):
9 """
9 """
10 Raised if message contains newlines in headers.
10 Raised if message contains newlines in headers.
11 """
11 """
@@ -13,11 +13,11 b' class Attachment(object):'
13 :param disposition: content-disposition (if any)
13 :param disposition: content-disposition (if any)
14 """
14 """
15
15
16 def __init__(self,
16 def __init__(self,
17 filename=None,
17 filename=None,
18 content_type=None,
18 content_type=None,
19 data=None,
19 data=None,
20 disposition=None):
20 disposition=None):
21
21
22 self.filename = filename
22 self.filename = filename
23 self.content_type = content_type
23 self.content_type = content_type
@@ -47,11 +47,11 b' class Message(object):'
47 :param attachments: list of Attachment instances
47 :param attachments: list of Attachment instances
48 """
48 """
49
49
50 def __init__(self,
50 def __init__(self,
51 subject=None,
51 subject=None,
52 recipients=None,
52 recipients=None,
53 body=None,
53 body=None,
54 html=None,
54 html=None,
55 sender=None,
55 sender=None,
56 cc=None,
56 cc=None,
57 bcc=None,
57 bcc=None,
@@ -78,7 +78,7 b' class Message(object):'
78 """
78 """
79 Returns raw email.Message instance.Validates message first.
79 Returns raw email.Message instance.Validates message first.
80 """
80 """
81
81
82 self.validate()
82 self.validate()
83
83
84 return self.get_response().to_message()
84 return self.get_response().to_message()
@@ -88,7 +88,7 b' class Message(object):'
88 Creates a Lamson MailResponse instance
88 Creates a Lamson MailResponse instance
89 """
89 """
90
90
91 response = MailResponse(Subject=self.subject,
91 response = MailResponse(Subject=self.subject,
92 To=self.recipients,
92 To=self.recipients,
93 From=self.sender,
93 From=self.sender,
94 Body=self.body,
94 Body=self.body,
@@ -102,20 +102,20 b' class Message(object):'
102
102
103 for attachment in self.attachments:
103 for attachment in self.attachments:
104
104
105 response.attach(attachment.filename,
105 response.attach(attachment.filename,
106 attachment.content_type,
106 attachment.content_type,
107 attachment.data,
107 attachment.data,
108 attachment.disposition)
108 attachment.disposition)
109
109
110 response.update(self.extra_headers)
110 response.update(self.extra_headers)
111
111
112 return response
112 return response
113
113
114 def is_bad_headers(self):
114 def is_bad_headers(self):
115 """
115 """
116 Checks for bad headers i.e. newlines in subject, sender or recipients.
116 Checks for bad headers i.e. newlines in subject, sender or recipients.
117 """
117 """
118
118
119 headers = [self.subject, self.sender]
119 headers = [self.subject, self.sender]
120 headers += list(self.send_to)
120 headers += list(self.send_to)
121 headers += self.extra_headers.values()
121 headers += self.extra_headers.values()
@@ -125,7 +125,7 b' class Message(object):'
125 if c in val:
125 if c in val:
126 return True
126 return True
127 return False
127 return False
128
128
129 def validate(self):
129 def validate(self):
130 """
130 """
131 Checks if message is valid and raises appropriate exception.
131 Checks if message is valid and raises appropriate exception.
@@ -146,15 +146,15 b' class Message(object):'
146 def add_recipient(self, recipient):
146 def add_recipient(self, recipient):
147 """
147 """
148 Adds another recipient to the message.
148 Adds another recipient to the message.
149
149
150 :param recipient: email address of recipient.
150 :param recipient: email address of recipient.
151 """
151 """
152
152
153 self.recipients.append(recipient)
153 self.recipients.append(recipient)
154
154
155 def add_cc(self, recipient):
155 def add_cc(self, recipient):
156 """
156 """
157 Adds an email address to the CC list.
157 Adds an email address to the CC list.
158
158
159 :param recipient: email address of recipient.
159 :param recipient: email address of recipient.
160 """
160 """
@@ -163,7 +163,7 b' class Message(object):'
163
163
164 def add_bcc(self, recipient):
164 def add_bcc(self, recipient):
165 """
165 """
166 Adds an email address to the BCC list.
166 Adds an email address to the BCC list.
167
167
168 :param recipient: email address of recipient.
168 :param recipient: email address of recipient.
169 """
169 """
@@ -178,5 +178,3 b' class Message(object):'
178 """
178 """
179
179
180 self.attachments.append(attachment)
180 self.attachments.append(attachment)
181
182
@@ -48,7 +48,7 b" VALUE_IS_EMAIL_ADDRESS = lambda v: '@' i"
48 def normalize_header(header):
48 def normalize_header(header):
49 return string.capwords(header.lower(), '-')
49 return string.capwords(header.lower(), '-')
50
50
51 class EncodingError(Exception):
51 class EncodingError(Exception):
52 """Thrown when there is an encoding error."""
52 """Thrown when there is an encoding error."""
53 pass
53 pass
54
54
@@ -61,7 +61,7 b' class MailBase(object):'
61 self.headers = dict(items)
61 self.headers = dict(items)
62 self.parts = []
62 self.parts = []
63 self.body = None
63 self.body = None
64 self.content_encoding = {'Content-Type': (None, {}),
64 self.content_encoding = {'Content-Type': (None, {}),
65 'Content-Disposition': (None, {}),
65 'Content-Disposition': (None, {}),
66 'Content-Transfer-Encoding': (None, {})}
66 'Content-Transfer-Encoding': (None, {})}
67
67
@@ -312,7 +312,7 b' class MailResponse(object):'
312
312
313 def to_message(mail):
313 def to_message(mail):
314 """
314 """
315 Given a MailBase message, this will construct a MIMEPart
315 Given a MailBase message, this will construct a MIMEPart
316 that is canonicalized for use with the Python email API.
316 that is canonicalized for use with the Python email API.
317 """
317 """
318 ctype, params = mail.content_encoding['Content-Type']
318 ctype, params = mail.content_encoding['Content-Type']
@@ -201,7 +201,7 b' def is_valid_repo(repo_name, base_path):'
201 def is_valid_repos_group(repos_group_name, base_path):
201 def is_valid_repos_group(repos_group_name, base_path):
202 """
202 """
203 Returns True if given path is a repos group False otherwise
203 Returns True if given path is a repos group False otherwise
204
204
205 :param repo_name:
205 :param repo_name:
206 :param base_path:
206 :param base_path:
207 """
207 """
@@ -461,7 +461,7 b' def add_cache(settings):'
461 def create_test_index(repo_location, config, full_index):
461 def create_test_index(repo_location, config, full_index):
462 """
462 """
463 Makes default test index
463 Makes default test index
464
464
465 :param config: test config
465 :param config: test config
466 :param full_index:
466 :param full_index:
467 """
467 """
@@ -597,4 +597,4 b' class BasePasterCommand(Command):'
597
597
598 path_to_ini_file = os.path.realpath(conf)
598 path_to_ini_file = os.path.realpath(conf)
599 conf = paste.deploy.appconfig('config:' + path_to_ini_file)
599 conf = paste.deploy.appconfig('config:' + path_to_ini_file)
600 pylonsconfig.init_app(conf.global_conf, conf.local_conf) No newline at end of file
600 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
@@ -96,7 +96,7 b' class BaseModel(object):'
96 def get_dict(self, serialized=False):
96 def get_dict(self, serialized=False):
97 """
97 """
98 return dict with keys and values corresponding
98 return dict with keys and values corresponding
99 to this model data
99 to this model data
100 """
100 """
101
101
102 d = {}
102 d = {}
@@ -106,7 +106,7 b' class BaseModel(object):'
106 # also use __json__() if present to get additional fields
106 # also use __json__() if present to get additional fields
107 if hasattr(self, '__json__'):
107 if hasattr(self, '__json__'):
108 for k, val in self.__json__().iteritems():
108 for k, val in self.__json__().iteritems():
109 d[k] = val
109 d[k] = val
110 return d
110 return d
111
111
112 def get_appstruct(self):
112 def get_appstruct(self):
@@ -970,7 +970,7 b' class CacheInvalidation(Base, BaseModel)'
970 Returns Invalidation object if this given key should be invalidated
970 Returns Invalidation object if this given key should be invalidated
971 None otherwise. `cache_active = False` means that this cache
971 None otherwise. `cache_active = False` means that this cache
972 state is not valid and needs to be invalidated
972 state is not valid and needs to be invalidated
973
973
974 :param key:
974 :param key:
975 """
975 """
976 return cls.query()\
976 return cls.query()\
@@ -982,7 +982,7 b' class CacheInvalidation(Base, BaseModel)'
982 def set_invalidate(cls, key):
982 def set_invalidate(cls, key):
983 """
983 """
984 Mark this Cache key for invalidation
984 Mark this Cache key for invalidation
985
985
986 :param key:
986 :param key:
987 """
987 """
988
988
@@ -1006,7 +1006,7 b' class CacheInvalidation(Base, BaseModel)'
1006 def set_valid(cls, key):
1006 def set_valid(cls, key):
1007 """
1007 """
1008 Mark this cache key as active and currently cached
1008 Mark this cache key as active and currently cached
1009
1009
1010 :param key:
1010 :param key:
1011 """
1011 """
1012 inv_obj = CacheInvalidation.query()\
1012 inv_obj = CacheInvalidation.query()\
@@ -1037,7 +1037,7 b' class ChangesetComment(Base, BaseModel):'
1037 """
1037 """
1038 Returns user associated with this changesetComment. ie those
1038 Returns user associated with this changesetComment. ie those
1039 who actually commented
1039 who actually commented
1040
1040
1041 :param cls:
1041 :param cls:
1042 :param revision:
1042 :param revision:
1043 """
1043 """
@@ -1120,4 +1120,3 b' class DbMigrateVersion(Base, BaseModel):'
1120 repository_id = Column('repository_id', String(250), primary_key=True)
1120 repository_id = Column('repository_id', String(250), primary_key=True)
1121 repository_path = Column('repository_path', Text)
1121 repository_path = Column('repository_path', Text)
1122 version = Column('version', Integer)
1122 version = Column('version', Integer)
1123
@@ -483,7 +483,7 b' class LoginForm(formencode.Schema):'
483 )
483 )
484
484
485 remember = StringBoolean(if_missing=False)
485 remember = StringBoolean(if_missing=False)
486
486
487 chained_validators = [ValidAuth]
487 chained_validators = [ValidAuth]
488
488
489 def UserForm(edit=False, old_data={}):
489 def UserForm(edit=False, old_data={}):
@@ -68,7 +68,7 b' class NotificationModel(BaseModel):'
68 notification
68 notification
69 :param subject:
69 :param subject:
70 :param body:
70 :param body:
71 :param recipients: list of int, str or User objects, when None
71 :param recipients: list of int, str or User objects, when None
72 is given send to all admins
72 is given send to all admins
73 :param type_: type of notification
73 :param type_: type of notification
74 :param with_email: send email with this notification
74 :param with_email: send email with this notification
@@ -206,7 +206,7 b' class EmailNotificationModel(BaseModel):'
206 def get_email_tmpl(self, type_, **kwargs):
206 def get_email_tmpl(self, type_, **kwargs):
207 """
207 """
208 return generated template for email based on given type
208 return generated template for email based on given type
209
209
210 :param type_:
210 :param type_:
211 """
211 """
212
212
@@ -217,5 +217,3 b' class EmailNotificationModel(BaseModel):'
217 _kwargs.update(kwargs)
217 _kwargs.update(kwargs)
218 log.debug('rendering tmpl %s with kwargs %s' % (base, _kwargs))
218 log.debug('rendering tmpl %s with kwargs %s' % (base, _kwargs))
219 return email_template.render(**_kwargs)
219 return email_template.render(**_kwargs)
220
221
@@ -94,9 +94,9 b' class RepoModel(BaseModel):'
94
94
95 def _get_defaults(self, repo_name):
95 def _get_defaults(self, repo_name):
96 """
96 """
97 Get's information about repository, and returns a dict for
97 Get's information about repository, and returns a dict for
98 usage in forms
98 usage in forms
99
99
100 :param repo_name:
100 :param repo_name:
101 """
101 """
102
102
@@ -299,7 +299,7 b' class RepoModel(BaseModel):'
299 def create_fork(self, form_data, cur_user):
299 def create_fork(self, form_data, cur_user):
300 """
300 """
301 Simple wrapper into executing celery task for fork creation
301 Simple wrapper into executing celery task for fork creation
302
302
303 :param form_data:
303 :param form_data:
304 :param cur_user:
304 :param cur_user:
305 """
305 """
@@ -340,7 +340,7 b' class RepoModel(BaseModel):'
340 def delete_stats(self, repo_name):
340 def delete_stats(self, repo_name):
341 """
341 """
342 removes stats for given repo
342 removes stats for given repo
343
343
344 :param repo_name:
344 :param repo_name:
345 """
345 """
346 try:
346 try:
@@ -427,4 +427,3 b' class RepoModel(BaseModel):'
427 % (datetime.today()\
427 % (datetime.today()\
428 .strftime('%Y%m%d_%H%M%S_%f'),
428 .strftime('%Y%m%d_%H%M%S_%f'),
429 repo.repo_name)))
429 repo.repo_name)))
430
@@ -63,7 +63,7 b' class RepositoryPermissionModel(BaseMode'
63 .filter(UsersGroupRepoToPerm.repository == repository) \
63 .filter(UsersGroupRepoToPerm.repository == repository) \
64 .scalar()
64 .scalar()
65
65
66 def update_users_group_permission(self, repository, users_group,
66 def update_users_group_permission(self, repository, users_group,
67 permission):
67 permission):
68 permission = Permission.get_by_key(permission)
68 permission = Permission.get_by_key(permission)
69 current = self.get_users_group_permission(repository, users_group)
69 current = self.get_users_group_permission(repository, users_group)
@@ -94,4 +94,4 b' class RepositoryPermissionModel(BaseMode'
94 self.update_users_group_permission(repository, user_group,
94 self.update_users_group_permission(repository, user_group,
95 permission)
95 permission)
96 else:
96 else:
97 self.delete_users_group_permission(repository, user_group) No newline at end of file
97 self.delete_users_group_permission(repository, user_group)
@@ -68,7 +68,7 b' class ReposGroupModel(BaseModel):'
68 def __rename_group(self, old, new):
68 def __rename_group(self, old, new):
69 """
69 """
70 Renames a group on filesystem
70 Renames a group on filesystem
71
71
72 :param group_name:
72 :param group_name:
73 """
73 """
74
74
@@ -92,7 +92,7 b' class ReposGroupModel(BaseModel):'
92 def __delete_group(self, group):
92 def __delete_group(self, group):
93 """
93 """
94 Deletes a group from a filesystem
94 Deletes a group from a filesystem
95
95
96 :param group: instance of group from database
96 :param group: instance of group from database
97 """
97 """
98 paths = group.full_path.split(RepoGroup.url_sep())
98 paths = group.full_path.split(RepoGroup.url_sep())
@@ -136,7 +136,7 b' class ReposGroupModel(BaseModel):'
136
136
137 self.__rename_group(old_path, new_path)
137 self.__rename_group(old_path, new_path)
138
138
139 # we need to get all repositories from this new group and
139 # we need to get all repositories from this new group and
140 # rename them accordingly to new group path
140 # rename them accordingly to new group path
141 for r in repos_group.repositories:
141 for r in repos_group.repositories:
142 r.repo_name = r.get_new_name(r.just_name)
142 r.repo_name = r.get_new_name(r.just_name)
@@ -97,7 +97,7 b' class UserModel(BaseModel):'
97 active=True, admin=False, ldap_dn=None):
97 active=True, admin=False, ldap_dn=None):
98 """
98 """
99 Creates a new instance if not found, or updates current one
99 Creates a new instance if not found, or updates current one
100
100
101 :param username:
101 :param username:
102 :param password:
102 :param password:
103 :param email:
103 :param email:
@@ -140,7 +140,7 b' class UserModel(BaseModel):'
140 def create_for_container_auth(self, username, attrs):
140 def create_for_container_auth(self, username, attrs):
141 """
141 """
142 Creates the given user if it's not already in the database
142 Creates the given user if it's not already in the database
143
143
144 :param username:
144 :param username:
145 :param attrs:
145 :param attrs:
146 """
146 """
@@ -173,7 +173,7 b' class UserModel(BaseModel):'
173 """
173 """
174 Checks if user is in database, if not creates this user marked
174 Checks if user is in database, if not creates this user marked
175 as ldap user
175 as ldap user
176
176
177 :param username:
177 :param username:
178 :param password:
178 :param password:
179 :param user_dn:
179 :param user_dn:
@@ -283,7 +283,7 b' class UserModel(BaseModel):'
283
283
284 def delete(self, user):
284 def delete(self, user):
285 user = self.__get_user(user)
285 user = self.__get_user(user)
286
286
287 try:
287 try:
288 if user.username == 'default':
288 if user.username == 'default':
289 raise DefaultUserException(
289 raise DefaultUserException(
@@ -498,9 +498,9 b' class UserModel(BaseModel):'
498 if not isinstance(perm, Permission):
498 if not isinstance(perm, Permission):
499 raise Exception('perm needs to be an instance of Permission class '
499 raise Exception('perm needs to be an instance of Permission class '
500 'got %s instead' % type(perm))
500 'got %s instead' % type(perm))
501
501
502 user = self.__get_user(user)
502 user = self.__get_user(user)
503
503
504 obj = UserToPerm.query().filter(UserToPerm.user == user)\
504 obj = UserToPerm.query().filter(UserToPerm.user == user)\
505 .filter(UserToPerm.permission == perm).scalar()
505 .filter(UserToPerm.permission == perm).scalar()
506 if obj:
506 if obj:
@@ -82,7 +82,7 b' class UsersGroupModel(BaseModel):'
82 def delete(self, users_group):
82 def delete(self, users_group):
83 try:
83 try:
84 users_group = self.__get_users_group(users_group)
84 users_group = self.__get_users_group(users_group)
85
85
86 # check if this group is not assigned to repo
86 # check if this group is not assigned to repo
87 assigned_groups = UsersGroupRepoToPerm.query()\
87 assigned_groups = UsersGroupRepoToPerm.query()\
88 .filter(UsersGroupRepoToPerm.users_group == users_group).all()
88 .filter(UsersGroupRepoToPerm.users_group == users_group).all()
@@ -90,7 +90,7 b' class UsersGroupModel(BaseModel):'
90 if assigned_groups:
90 if assigned_groups:
91 raise UsersGroupsAssignedException('RepoGroup assigned to %s' %
91 raise UsersGroupsAssignedException('RepoGroup assigned to %s' %
92 assigned_groups)
92 assigned_groups)
93
93
94 self.sa.delete(users_group)
94 self.sa.delete(users_group)
95 except:
95 except:
96 log.error(traceback.format_exc())
96 log.error(traceback.format_exc())
@@ -141,12 +141,10 b' class UsersGroupModel(BaseModel):'
141 def revoke_perm(self, users_group, perm):
141 def revoke_perm(self, users_group, perm):
142 if not isinstance(perm, Permission):
142 if not isinstance(perm, Permission):
143 raise Exception('perm needs to be an instance of Permission class')
143 raise Exception('perm needs to be an instance of Permission class')
144
144
145 users_group = self.__get_users_group(users_group)
145 users_group = self.__get_users_group(users_group)
146
146
147 obj = UsersGroupToPerm.query()\
147 obj = UsersGroupToPerm.query()\
148 .filter(UsersGroupToPerm.users_group == users_group)\
148 .filter(UsersGroupToPerm.users_group == users_group)\
149 .filter(UsersGroupToPerm.permission == perm).one()
149 .filter(UsersGroupToPerm.permission == perm).one()
150 self.sa.delete(obj)
150 self.sa.delete(obj)
151
152
@@ -44,7 +44,7 b' log = logging.getLogger(__name__)'
44
44
45 ##RUNNING DESIRED TESTS
45 ##RUNNING DESIRED TESTS
46 # nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
46 # nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
47 # nosetests --pdb --pdb-failures
47 # nosetests --pdb --pdb-failures
48 environ = {}
48 environ = {}
49
49
50 #SOME GLOBALS FOR TESTS
50 #SOME GLOBALS FOR TESTS
@@ -107,4 +107,3 b' class TestController(TestCase):'
107 def checkSessionFlash(self, response, msg):
107 def checkSessionFlash(self, response, msg):
108 self.assertTrue('flash' in response.session)
108 self.assertTrue('flash' in response.session)
109 self.assertTrue(msg in response.session['flash'][0][1])
109 self.assertTrue(msg in response.session['flash'][0][1])
110
@@ -22,7 +22,7 b' class TestLdapSettingsController(TestCon'
22 self.log_user()
22 self.log_user()
23 if skip_ldap_test:
23 if skip_ldap_test:
24 raise SkipTest('skipping due to missing ldap lib')
24 raise SkipTest('skipping due to missing ldap lib')
25
25
26 test_url = url(controller='admin/ldap_settings',
26 test_url = url(controller='admin/ldap_settings',
27 action='ldap_settings')
27 action='ldap_settings')
28
28
@@ -53,7 +53,7 b' class TestLdapSettingsController(TestCon'
53 self.log_user()
53 self.log_user()
54 if skip_ldap_test:
54 if skip_ldap_test:
55 raise SkipTest('skipping due to missing ldap lib')
55 raise SkipTest('skipping due to missing ldap lib')
56
56
57 test_url = url(controller='admin/ldap_settings',
57 test_url = url(controller='admin/ldap_settings',
58 action='ldap_settings')
58 action='ldap_settings')
59
59
@@ -71,13 +71,13 b' class TestLdapSettingsController(TestCon'
71 'ldap_attr_firstname':'',
71 'ldap_attr_firstname':'',
72 'ldap_attr_lastname':'',
72 'ldap_attr_lastname':'',
73 'ldap_attr_email':'' })
73 'ldap_attr_email':'' })
74
74
75 self.assertTrue("""<span class="error-message">The LDAP Login"""
75 self.assertTrue("""<span class="error-message">The LDAP Login"""
76 """ attribute of the CN must be specified""" in
76 """ attribute of the CN must be specified""" in
77 response.body)
77 response.body)
78
78
79
79
80
80
81 self.assertTrue("""<span class="error-message">Please """
81 self.assertTrue("""<span class="error-message">Please """
82 """enter a number</span>""" in response.body)
82 """enter a number</span>""" in response.body)
83
83
@@ -23,7 +23,7 b' class TestAdminUsersController(TestContr'
23 lastname = 'lastname'
23 lastname = 'lastname'
24 email = 'mail@mail.com'
24 email = 'mail@mail.com'
25
25
26 response = self.app.post(url('users'),
26 response = self.app.post(url('users'),
27 {'username':username,
27 {'username':username,
28 'password':password,
28 'password':password,
29 'password_confirmation':password_confirmation,
29 'password_confirmation':password_confirmation,
@@ -33,7 +33,7 b' class TestAdminUsersController(TestContr'
33 'email':email})
33 'email':email})
34
34
35
35
36 self.assertTrue('''created user %s''' % (username) in
36 self.assertTrue('''created user %s''' % (username) in
37 response.session['flash'][0])
37 response.session['flash'][0])
38
38
39 new_user = self.Session.query(User).\
39 new_user = self.Session.query(User).\
@@ -108,12 +108,12 b' class TestAdminUsersController(TestContr'
108 .filter(User.username == username).one()
108 .filter(User.username == username).one()
109 response = self.app.delete(url('user', id=new_user.user_id))
109 response = self.app.delete(url('user', id=new_user.user_id))
110
110
111 self.assertTrue("""successfully deleted user""" in
111 self.assertTrue("""successfully deleted user""" in
112 response.session['flash'][0])
112 response.session['flash'][0])
113
113
114
114
115 def test_delete_browser_fakeout(self):
115 def test_delete_browser_fakeout(self):
116 response = self.app.post(url('user', id=1),
116 response = self.app.post(url('user', id=1),
117 params=dict(_method='delete'))
117 params=dict(_method='delete'))
118
118
119 def test_show(self):
119 def test_show(self):
@@ -85,7 +85,3 b' class TestAdminUsersGroupsController(Tes'
85
85
86 def test_revoke_members(self):
86 def test_revoke_members(self):
87 pass
87 pass
88
89
90
91
@@ -9,9 +9,3 b' class TestBranchesController(TestControl'
9 response.mustcontain("""<a href="/%s/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/">default</a>""" % HG_REPO)
9 response.mustcontain("""<a href="/%s/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/">default</a>""" % HG_REPO)
10 response.mustcontain("""<a href="/%s/files/97e8b885c04894463c51898e14387d80c30ed1ee/">git</a>""" % HG_REPO)
10 response.mustcontain("""<a href="/%s/files/97e8b885c04894463c51898e14387d80c30ed1ee/">git</a>""" % HG_REPO)
11 response.mustcontain("""<a href="/%s/files/2e6a2bf9356ca56df08807f4ad86d480da72a8f4/">web</a>""" % HG_REPO)
11 response.mustcontain("""<a href="/%s/files/2e6a2bf9356ca56df08807f4ad86d480da72a8f4/">web</a>""" % HG_REPO)
12
13
14
15
16
17
@@ -137,7 +137,3 b' class TestChangeSetCommentrController(Te'
137 repo_name=HG_REPO, revision=rev))
137 repo_name=HG_REPO, revision=rev))
138 self.assertTrue('''<div class="comments-number">0 comment(s)'''
138 self.assertTrue('''<div class="comments-number">0 comment(s)'''
139 ''' (0 inline)</div>''' in response.body)
139 ''' (0 inline)</div>''' in response.body)
140
141
142
143
@@ -314,13 +314,10 b' removed extra unicode conversion in diff'
314
314
315 def test_ajaxed_files_list(self):
315 def test_ajaxed_files_list(self):
316 self.log_user()
316 self.log_user()
317 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
317 rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
318 response = self.app.get(url('files_nodelist_home',repo_name=HG_REPO,
318 response = self.app.get(url('files_nodelist_home',repo_name=HG_REPO,
319 f_path='/',
319 f_path='/',
320 revision=rev),
320 revision=rev),
321 extra_environ={'HTTP_X_PARTIAL_XHR':'1'},
321 extra_environ={'HTTP_X_PARTIAL_XHR':'1'},
322 )
322 )
323 self.assertTrue("vcs/web/simplevcs/views/repository.py" in response.body)
323 self.assertTrue("vcs/web/simplevcs/views/repository.py" in response.body)
324
325
326
@@ -9,7 +9,7 b' class TestSummaryController(TestControll'
9 self.log_user()
9 self.log_user()
10 ID = Repository.get_by_repo_name(HG_REPO).repo_id
10 ID = Repository.get_by_repo_name(HG_REPO).repo_id
11 response = self.app.get(url(controller='summary',
11 response = self.app.get(url(controller='summary',
12 action='index',
12 action='index',
13 repo_name=HG_REPO))
13 repo_name=HG_REPO))
14
14
15 #repo type
15 #repo type
@@ -44,7 +44,7 b' class TestSummaryController(TestControll'
44 self.log_user()
44 self.log_user()
45 ID = Repository.get_by_repo_name(HG_REPO).repo_id
45 ID = Repository.get_by_repo_name(HG_REPO).repo_id
46 response = self.app.get(url(controller='summary',
46 response = self.app.get(url(controller='summary',
47 action='index',
47 action='index',
48 repo_name='_%s' % ID))
48 repo_name='_%s' % ID))
49
49
50 #repo type
50 #repo type
@@ -10,4 +10,3 b' class TestTagsController(TestController)'
10 response.mustcontain("""<a href="/%s/files/17544fbfcd33ffb439e2b728b5d526b1ef30bfcf/">0.1.3</a>""" % HG_REPO)
10 response.mustcontain("""<a href="/%s/files/17544fbfcd33ffb439e2b728b5d526b1ef30bfcf/">0.1.3</a>""" % HG_REPO)
11 response.mustcontain("""<a href="/%s/files/a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720/">0.1.2</a>""" % HG_REPO)
11 response.mustcontain("""<a href="/%s/files/a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720/">0.1.2</a>""" % HG_REPO)
12 response.mustcontain("""<a href="/%s/files/eb3a60fc964309c1a318b8dfe26aa2d1586c85ae/">0.1.1</a>""" % HG_REPO)
12 response.mustcontain("""<a href="/%s/files/eb3a60fc964309c1a318b8dfe26aa2d1586c85ae/">0.1.1</a>""" % HG_REPO)
13
@@ -6,7 +6,7 b''
6 Test for crawling a project for memory usage
6 Test for crawling a project for memory usage
7 This should be runned just as regular script together
7 This should be runned just as regular script together
8 with a watch script that will show memory usage.
8 with a watch script that will show memory usage.
9
9
10 watch -n1 ./rhodecode/tests/mem_watch
10 watch -n1 ./rhodecode/tests/mem_watch
11
11
12 :created_on: Apr 21, 2010
12 :created_on: Apr 21, 2010
@@ -5,7 +5,7 b''
5
5
6
6
7 Package for testing various lib/helper functions in rhodecode
7 Package for testing various lib/helper functions in rhodecode
8
8
9 :created_on: Jun 9, 2011
9 :created_on: Jun 9, 2011
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
11 :license: GPLv3, see COPYING for more details.
@@ -112,5 +112,3 b' class TestLibs(unittest.TestCase):'
112 s = ['2one_more22', 'D', 'MARCIN', 'first', 'lukaszb',
112 s = ['2one_more22', 'D', 'MARCIN', 'first', 'lukaszb',
113 'maRCiN', 'marcink', 'one']
113 'maRCiN', 'marcink', 'one']
114 self.assertEqual(s, extract_mentioned_users(sample))
114 self.assertEqual(s, extract_mentioned_users(sample))
115
116
@@ -161,7 +161,7 b' class TestUser(unittest.TestCase):'
161 def __init__(self, methodName='runTest'):
161 def __init__(self, methodName='runTest'):
162 Session.remove()
162 Session.remove()
163 super(TestUser, self).__init__(methodName=methodName)
163 super(TestUser, self).__init__(methodName=methodName)
164
164
165 def test_create_and_remove(self):
165 def test_create_and_remove(self):
166 usr = UserModel().create_or_update(username=u'test_user', password=u'qweqwe',
166 usr = UserModel().create_or_update(username=u'test_user', password=u'qweqwe',
167 email=u'u232@rhodecode.org',
167 email=u'u232@rhodecode.org',
@@ -370,13 +370,13 b' class TestUsers(unittest.TestCase):'
370 self.u1 = UserModel().create_or_update(username=u'u1',
370 self.u1 = UserModel().create_or_update(username=u'u1',
371 password=u'qweqwe',
371 password=u'qweqwe',
372 email=u'u1@rhodecode.org',
372 email=u'u1@rhodecode.org',
373 name=u'u1', lastname=u'u1')
373 name=u'u1', lastname=u'u1')
374
374
375 def tearDown(self):
375 def tearDown(self):
376 perm = Permission.query().all()
376 perm = Permission.query().all()
377 for p in perm:
377 for p in perm:
378 UserModel().revoke_perm(self.u1, p)
378 UserModel().revoke_perm(self.u1, p)
379
379
380 UserModel().delete(self.u1)
380 UserModel().delete(self.u1)
381 Session.commit()
381 Session.commit()
382
382
@@ -402,9 +402,3 b' class TestUsers(unittest.TestCase):'
402 UserModel().revoke_perm(self.u1, perm)
402 UserModel().revoke_perm(self.u1, perm)
403 Session.commit()
403 Session.commit()
404 self.assertEqual(UserModel().has_perm(self.u1, perm),False)
404 self.assertEqual(UserModel().has_perm(self.u1, perm),False)
405
406
407
408
409
410
General Comments 0
You need to be logged in to leave comments. Login now