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