modernize: updates for python3
This commit is contained in:
parent
a6e9ccf9e0
commit
4bbb30fa06
155 changed files with 232 additions and 455 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -22,7 +21,7 @@ import datetime
|
|||
import collections
|
||||
|
||||
now = datetime.datetime.now()
|
||||
now = now.strftime("%Y-%m-%d %H:%M:%S") + '.' + "{:03d}".format(int(now.microsecond/1000))
|
||||
now = now.strftime("%Y-%m-%d %H:%M:%S") + '.' + f"{int(now.microsecond/1000):03d}"
|
||||
|
||||
print(f'{now} Starting RhodeCode imports...')
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ def setup_request(request):
|
|||
json_body = ext_json.json.loads(raw_body)
|
||||
except ValueError as e:
|
||||
# catch JSON errors Here
|
||||
raise JSONRPCError("JSON parse error ERR:{} RAW:{!r}".format(e, raw_body))
|
||||
raise JSONRPCError(f"JSON parse error ERR:{e} RAW:{raw_body!r}")
|
||||
|
||||
request.rpc_id = json_body.get('id')
|
||||
request.rpc_method = json_body.get('method')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -44,7 +43,7 @@ def testuser_api(request, baseapp):
|
|||
# create TOKEN for user, if he doesn't have one
|
||||
if not cls.test_user.api_key:
|
||||
AuthTokenModel().create(
|
||||
user=cls.test_user, description=u'TEST_USER_TOKEN')
|
||||
user=cls.test_user, description='TEST_USER_TOKEN')
|
||||
|
||||
Session().commit()
|
||||
cls.TEST_USER_LOGIN = cls.test_user.username
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -31,7 +30,7 @@ class TestApi(object):
|
|||
def test_Optional_object(self):
|
||||
|
||||
option1 = Optional(None)
|
||||
assert '<Optional:%s>' % (None,) == repr(option1)
|
||||
assert '<Optional:{}>'.format(None) == repr(option1)
|
||||
assert option1() is None
|
||||
|
||||
assert 1 == Optional.extract(Optional(1))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2017-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ def get_gist(request, apiuser, gistid, content=Optional(False)):
|
|||
|
||||
if not has_superadmin_permission(apiuser):
|
||||
if gist.gist_owner != apiuser.user_id:
|
||||
raise JSONRPCError('gist `{}` does not exist'.format(gistid))
|
||||
raise JSONRPCError(f'gist `{gistid}` does not exist')
|
||||
data = gist.get_api_data()
|
||||
|
||||
if content:
|
||||
|
|
@ -240,13 +240,13 @@ def delete_gist(request, apiuser, gistid):
|
|||
gist = get_gist_or_error(gistid)
|
||||
if not has_superadmin_permission(apiuser):
|
||||
if gist.gist_owner != apiuser.user_id:
|
||||
raise JSONRPCError('gist `{}` does not exist'.format(gistid))
|
||||
raise JSONRPCError(f'gist `{gistid}` does not exist')
|
||||
|
||||
try:
|
||||
GistModel().delete(gist)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': 'deleted gist ID:{}'.format(gist.gist_access_id),
|
||||
'msg': f'deleted gist ID:{gist.gist_access_id}',
|
||||
'gist': None
|
||||
}
|
||||
except Exception:
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ def comment_pull_request(
|
|||
|
||||
if not PullRequestModel().check_user_read(
|
||||
pull_request, apiuser, api=True):
|
||||
raise JSONRPCError('repository `{}` does not exist'.format(repoid))
|
||||
raise JSONRPCError(f'repository `{repoid}` does not exist')
|
||||
message = Optional.extract(message)
|
||||
status = Optional.extract(status)
|
||||
commit_id = Optional.extract(commit_id)
|
||||
|
|
@ -1082,7 +1082,7 @@ def close_pull_request(
|
|||
|
||||
if pull_request.is_closed():
|
||||
raise JSONRPCError(
|
||||
'pull request `{}` is already closed'.format(pullrequestid))
|
||||
f'pull request `{pullrequestid}` is already closed')
|
||||
|
||||
# only owner or admin or person with write permissions
|
||||
allowed_to_close = PullRequestModel().check_user_update(
|
||||
|
|
|
|||
|
|
@ -918,13 +918,13 @@ def add_field_to_repo(request, apiuser, repoid, key, label=Optional(''),
|
|||
field_desc=description)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': "Added new repository field `{}`".format(key),
|
||||
'msg': f"Added new repository field `{key}`",
|
||||
'success': True,
|
||||
}
|
||||
except Exception:
|
||||
log.exception("Exception occurred while trying to add field to repo")
|
||||
raise JSONRPCError(
|
||||
'failed to create new field for repository `{}`'.format(repoid))
|
||||
f'failed to create new field for repository `{repoid}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -957,14 +957,14 @@ def remove_field_from_repo(request, apiuser, repoid, key):
|
|||
RepoModel().delete_repo_field(repo, field_key=key)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': "Deleted repository field `{}`".format(key),
|
||||
'msg': f"Deleted repository field `{key}`",
|
||||
'success': True,
|
||||
}
|
||||
except Exception:
|
||||
log.exception(
|
||||
"Exception occurred while trying to delete field from repo")
|
||||
raise JSONRPCError(
|
||||
'failed to delete field for repository `{}`'.format(repoid))
|
||||
f'failed to delete field for repository `{repoid}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -1130,7 +1130,7 @@ def update_repo(
|
|||
user=apiuser, repo=repo)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': 'updated repo ID:{} {}'.format(repo.repo_id, repo.repo_name),
|
||||
'msg': f'updated repo ID:{repo.repo_id} {repo.repo_name}',
|
||||
'repository': repo.get_api_data(include_secrets=include_secrets)
|
||||
}
|
||||
except Exception:
|
||||
|
|
@ -1351,13 +1351,13 @@ def delete_repo(request, apiuser, repoid, forks=Optional('')):
|
|||
ScmModel().mark_for_invalidation(repo_name, delete=True)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': 'Deleted repository `{}`{}'.format(repo_name, _forks_msg),
|
||||
'msg': f'Deleted repository `{repo_name}`{_forks_msg}',
|
||||
'success': True
|
||||
}
|
||||
except Exception:
|
||||
log.exception("Exception occurred while trying to delete repo")
|
||||
raise JSONRPCError(
|
||||
'failed to delete repository `{}`'.format(repo_name)
|
||||
f'failed to delete repository `{repo_name}`'
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1412,7 +1412,7 @@ def invalidate_cache(request, apiuser, repoid, delete_keys=Optional(False)):
|
|||
try:
|
||||
ScmModel().mark_for_invalidation(repo.repo_name, delete=delete)
|
||||
return {
|
||||
'msg': 'Cache for repository `{}` was invalidated'.format(repoid),
|
||||
'msg': f'Cache for repository `{repoid}` was invalidated',
|
||||
'repository': repo.repo_name
|
||||
}
|
||||
except Exception:
|
||||
|
|
@ -1706,7 +1706,7 @@ def comment_commit(
|
|||
except Exception:
|
||||
log.exception("Exception occurred while trying to comment on commit")
|
||||
raise JSONRPCError(
|
||||
'failed to set comment on repository `{}`'.format(repo.repo_name)
|
||||
f'failed to set comment on repository `{repo.repo_name}`'
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1813,14 +1813,14 @@ def get_comment(request, apiuser, comment_id):
|
|||
|
||||
comment = ChangesetComment.get(comment_id)
|
||||
if not comment:
|
||||
raise JSONRPCError('comment `{}` does not exist'.format(comment_id))
|
||||
raise JSONRPCError(f'comment `{comment_id}` does not exist')
|
||||
|
||||
perms = ('repository.read', 'repository.write', 'repository.admin')
|
||||
has_comment_perm = HasRepoPermissionAnyApi(*perms)\
|
||||
(user=apiuser, repo_name=comment.repo.repo_name)
|
||||
|
||||
if not has_comment_perm:
|
||||
raise JSONRPCError('comment `{}` does not exist'.format(comment_id))
|
||||
raise JSONRPCError(f'comment `{comment_id}` does not exist')
|
||||
|
||||
return comment
|
||||
|
||||
|
|
@ -1858,7 +1858,7 @@ def edit_comment(request, apiuser, message, comment_id, version,
|
|||
auth_user = apiuser
|
||||
comment = ChangesetComment.get(comment_id)
|
||||
if not comment:
|
||||
raise JSONRPCError('comment `{}` does not exist'.format(comment_id))
|
||||
raise JSONRPCError(f'comment `{comment_id}` does not exist')
|
||||
|
||||
is_super_admin = has_superadmin_permission(apiuser)
|
||||
is_repo_admin = HasRepoPermissionAnyApi('repository.admin')\
|
||||
|
|
@ -2120,7 +2120,7 @@ def grant_user_group_permission(request, apiuser, repoid, usergroupid, perm):
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
perm_additions = [[user_group.users_group_id, perm.permission_name, "user_group"]]
|
||||
try:
|
||||
|
|
@ -2194,7 +2194,7 @@ def revoke_user_group_permission(request, apiuser, repoid, usergroupid):
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
perm_deletions = [[user_group.users_group_id, None, "user_group"]]
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ def get_repo_group(request, apiuser, repogroupid):
|
|||
if not HasRepoGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, group_name=repo_group.group_name):
|
||||
raise JSONRPCError(
|
||||
'repository group `{}` does not exist'.format(repogroupid))
|
||||
f'repository group `{repogroupid}` does not exist')
|
||||
|
||||
permissions = []
|
||||
for _user in repo_group.permissions():
|
||||
|
|
@ -240,7 +240,7 @@ def create_repo_group(
|
|||
except Exception:
|
||||
log.exception("Exception occurred while trying create repo group")
|
||||
raise JSONRPCError(
|
||||
'failed to create repo group `{}`'.format(validated_group_name))
|
||||
f'failed to create repo group `{validated_group_name}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -627,7 +627,7 @@ def grant_user_group_permission_to_repo_group(
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
apply_to_children = Optional.extract(apply_to_children)
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ def revoke_user_group_permission_from_repo_group(
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
apply_to_children = Optional.extract(apply_to_children)
|
||||
|
||||
|
|
|
|||
|
|
@ -230,10 +230,10 @@ def create_user(request, apiuser, username, email, password=Optional(''),
|
|||
raise JSONRPCForbidden()
|
||||
|
||||
if UserModel().get_by_username(username):
|
||||
raise JSONRPCError("user `{}` already exist".format(username))
|
||||
raise JSONRPCError(f"user `{username}` already exist")
|
||||
|
||||
if UserModel().get_by_email(email, case_insensitive=True):
|
||||
raise JSONRPCError("email `{}` already exist".format(email))
|
||||
raise JSONRPCError(f"email `{email}` already exist")
|
||||
|
||||
# generate random password if we actually given the
|
||||
# extern_name and it's not rhodecode
|
||||
|
|
@ -303,7 +303,7 @@ def create_user(request, apiuser, username, email, password=Optional(''),
|
|||
}
|
||||
except Exception:
|
||||
log.exception('Error occurred during creation of user')
|
||||
raise JSONRPCError('failed to create user `{}`'.format(username))
|
||||
raise JSONRPCError(f'failed to create user `{username}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -396,7 +396,7 @@ def update_user(request, apiuser, userid, username=Optional(None),
|
|||
user=apiuser)
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': 'updated user ID:{} {}'.format(user.user_id, user.username),
|
||||
'msg': f'updated user ID:{user.user_id} {user.username}',
|
||||
'user': user.get_api_data(include_secrets=True)
|
||||
}
|
||||
except DefaultUserException:
|
||||
|
|
@ -404,7 +404,7 @@ def update_user(request, apiuser, userid, username=Optional(None),
|
|||
raise JSONRPCError('editing default user is forbidden')
|
||||
except Exception:
|
||||
log.exception("Error occurred during update of user")
|
||||
raise JSONRPCError('failed to update user `{}`'.format(userid))
|
||||
raise JSONRPCError(f'failed to update user `{userid}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -465,13 +465,13 @@ def delete_user(request, apiuser, userid):
|
|||
|
||||
Session().commit()
|
||||
return {
|
||||
'msg': 'deleted user ID:{} {}'.format(user.user_id, user.username),
|
||||
'msg': f'deleted user ID:{user.user_id} {user.username}',
|
||||
'user': None
|
||||
}
|
||||
except Exception:
|
||||
log.exception("Error occurred during deleting of user")
|
||||
raise JSONRPCError(
|
||||
'failed to delete user ID:{} {}'.format(user.user_id, user.username))
|
||||
f'failed to delete user ID:{user.user_id} {user.username}')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ def create_user_group(
|
|||
raise JSONRPCForbidden()
|
||||
|
||||
if UserGroupModel().get_by_name(group_name):
|
||||
raise JSONRPCError("user group `{}` already exist".format(group_name))
|
||||
raise JSONRPCError(f"user group `{group_name}` already exist")
|
||||
|
||||
if isinstance(owner, Optional):
|
||||
owner = apiuser.user_id
|
||||
|
|
@ -277,7 +277,7 @@ def create_user_group(
|
|||
}
|
||||
except Exception:
|
||||
log.exception("Error occurred during creation of user group")
|
||||
raise JSONRPCError('failed to create group `{}`'.format(group_name))
|
||||
raise JSONRPCError(f'failed to create group `{group_name}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -339,7 +339,7 @@ def update_user_group(request, apiuser, usergroupid, group_name=Optional(''),
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
else:
|
||||
include_secrets = True
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ def update_user_group(request, apiuser, usergroupid, group_name=Optional(''),
|
|||
except Exception:
|
||||
log.exception("Error occurred during update of user group")
|
||||
raise JSONRPCError(
|
||||
'failed to update user group `{}`'.format(usergroupid))
|
||||
f'failed to update user group `{usergroupid}`')
|
||||
|
||||
|
||||
@jsonrpc_method()
|
||||
|
|
@ -429,7 +429,7 @@ def delete_user_group(request, apiuser, usergroupid):
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
old_data = user_group.get_api_data()
|
||||
try:
|
||||
|
|
@ -577,7 +577,7 @@ def remove_user_from_user_group(request, apiuser, usergroupid, userid):
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
old_values = user_group.get_api_data()
|
||||
try:
|
||||
|
|
@ -639,7 +639,7 @@ def grant_user_permission_to_user_group(
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
user = get_user_or_error(userid)
|
||||
perm = get_perm_or_error(perm, prefix='usergroup.')
|
||||
|
|
@ -711,7 +711,7 @@ def revoke_user_permission_from_user_group(
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(usergroupid))
|
||||
f'user group `{usergroupid}` does not exist')
|
||||
|
||||
user = get_user_or_error(userid)
|
||||
|
||||
|
|
@ -782,14 +782,14 @@ def grant_user_group_permission_to_user_group(
|
|||
user=apiuser,
|
||||
user_group_name=target_user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'to user group `{}` does not exist'.format(usergroupid))
|
||||
f'to user group `{usergroupid}` does not exist')
|
||||
|
||||
# check if we have at least read permission for source user group !
|
||||
_perms = ('usergroup.read', 'usergroup.write', 'usergroup.admin',)
|
||||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(sourceusergroupid))
|
||||
f'user group `{sourceusergroupid}` does not exist')
|
||||
|
||||
try:
|
||||
changes = UserGroupModel().grant_user_group_permission(
|
||||
|
|
@ -862,7 +862,7 @@ def revoke_user_group_permission_from_user_group(
|
|||
user=apiuser,
|
||||
user_group_name=target_user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'to user group `{}` does not exist'.format(usergroupid))
|
||||
f'to user group `{usergroupid}` does not exist')
|
||||
|
||||
# check if we have at least read permission
|
||||
# for the source user group !
|
||||
|
|
@ -870,7 +870,7 @@ def revoke_user_group_permission_from_user_group(
|
|||
if not HasUserGroupPermissionAnyApi(*_perms)(
|
||||
user=apiuser, user_group_name=user_group.users_group_name):
|
||||
raise JSONRPCError(
|
||||
'user group `{}` does not exist'.format(sourceusergroupid))
|
||||
f'user group `{sourceusergroupid}` does not exist')
|
||||
|
||||
try:
|
||||
changes = UserGroupModel().revoke_user_group_permission(
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ def _format_ref_id(name, raw_id):
|
|||
|
||||
def _format_ref_id_svn(name, raw_id):
|
||||
"""Special way of formatting a reference for Subversion including path"""
|
||||
return '{}@{}'.format(name, raw_id)
|
||||
return f'{name}@{raw_id}'
|
||||
|
||||
|
||||
class TemplateArgs(StrictAttributeDict):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -258,7 +256,7 @@ class UsersView(UserAppView):
|
|||
|
||||
except Exception:
|
||||
log.exception(
|
||||
'Could not extend user plugins with `{}`'.format(extern_type))
|
||||
f'Could not extend user plugins with `{extern_type}`')
|
||||
return valid_plugins
|
||||
|
||||
def load_default_context(self):
|
||||
|
|
@ -758,18 +756,18 @@ class UsersView(UserAppView):
|
|||
named_personal_group.personal = True
|
||||
Session().add(named_personal_group)
|
||||
Session().commit()
|
||||
msg = _('Linked repository group `%s` as personal' % (
|
||||
personal_repo_group_name,))
|
||||
msg = _('Linked repository group `{}` as personal'.format(
|
||||
personal_repo_group_name))
|
||||
h.flash(msg, category='success')
|
||||
elif not named_personal_group:
|
||||
RepoGroupModel().create_personal_repo_group(c.user)
|
||||
|
||||
msg = _('Created repository group `%s`' % (
|
||||
personal_repo_group_name,))
|
||||
msg = _('Created repository group `{}`'.format(
|
||||
personal_repo_group_name))
|
||||
h.flash(msg, category='success')
|
||||
else:
|
||||
msg = _('Repository group `%s` is already taken' % (
|
||||
personal_repo_group_name,))
|
||||
msg = _('Repository group `{}` is already taken'.format(
|
||||
personal_repo_group_name))
|
||||
h.flash(msg, category='warning')
|
||||
except Exception:
|
||||
log.exception("Exception during repository group creation")
|
||||
|
|
@ -1296,7 +1294,7 @@ class UsersView(UserAppView):
|
|||
c.active = 'caches'
|
||||
c.perm_user = c.user.AuthUser(ip_addr=self.request.remote_addr)
|
||||
|
||||
cache_namespace_uid = 'cache_user_auth.{}'.format(self.db_user.user_id)
|
||||
cache_namespace_uid = f'cache_user_auth.{self.db_user.user_id}'
|
||||
c.region = rc_cache.get_or_create_region('cache_perms', cache_namespace_uid)
|
||||
c.backend = c.region.backend
|
||||
c.user_keys = sorted(c.region.backend.list_keys(prefix=cache_namespace_uid))
|
||||
|
|
@ -1314,7 +1312,7 @@ class UsersView(UserAppView):
|
|||
c.active = 'caches'
|
||||
c.perm_user = c.user.AuthUser(ip_addr=self.request.remote_addr)
|
||||
|
||||
cache_namespace_uid = 'cache_user_auth.{}'.format(self.db_user.user_id)
|
||||
cache_namespace_uid = f'cache_user_auth.{self.db_user.user_id}'
|
||||
del_keys = rc_cache.clear_cache_namespace('cache_perms', cache_namespace_uid)
|
||||
|
||||
h.flash(_("Deleted {} cache keys").format(del_keys), category='success')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -115,7 +114,7 @@ class ChannelstreamView(BaseAppView):
|
|||
self.channelstream_config, payload, '/connect')
|
||||
except ChannelstreamConnectionException:
|
||||
log.exception(
|
||||
'Channelstream service at {} is down'.format(channelstream_url))
|
||||
f'Channelstream service at {channelstream_url} is down')
|
||||
return HTTPBadGateway()
|
||||
|
||||
channel_info = connect_result.get('channels_info')
|
||||
|
|
@ -167,7 +166,7 @@ class ChannelstreamView(BaseAppView):
|
|||
self.channelstream_config, payload, '/subscribe')
|
||||
except ChannelstreamConnectionException:
|
||||
log.exception(
|
||||
'Channelstream service at {} is down'.format(channelstream_url))
|
||||
f'Channelstream service at {channelstream_url} is down')
|
||||
return HTTPBadGateway()
|
||||
|
||||
channel_info = connect_result.get('channels_info')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -107,7 +105,7 @@ class LocalFileStorage(object):
|
|||
self.extensions = resolve_extensions([], groups=extension_groups)
|
||||
|
||||
def __repr__(self):
|
||||
return '{}@{}'.format(self.__class__, self.base_path)
|
||||
return f'{self.__class__}@{self.base_path}'
|
||||
|
||||
def store_path(self, filename):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -57,7 +55,7 @@ def resolve_extensions(extensions, groups=None):
|
|||
:param groups: additionally groups to extend the extensions.
|
||||
"""
|
||||
groups = groups or []
|
||||
valid_exts = set([x.lower() for x in extensions])
|
||||
valid_exts = {x.lower() for x in extensions}
|
||||
|
||||
for group in groups:
|
||||
if group in GROUPS:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -102,9 +101,9 @@ class TestFileStoreViews(TestController):
|
|||
status=200)
|
||||
|
||||
assert response.json == {
|
||||
u'error': u'store_file data field is missing',
|
||||
u'access_path': None,
|
||||
u'store_fid': None}
|
||||
'error': 'store_file data field is missing',
|
||||
'access_path': None,
|
||||
'store_fid': None}
|
||||
|
||||
def test_upload_files_bogus_content_to_store(self):
|
||||
self.log_user()
|
||||
|
|
@ -114,9 +113,9 @@ class TestFileStoreViews(TestController):
|
|||
status=200)
|
||||
|
||||
assert response.json == {
|
||||
u'error': u'filename cannot be read from the data field',
|
||||
u'access_path': None,
|
||||
u'store_fid': None}
|
||||
'error': 'filename cannot be read from the data field',
|
||||
'access_path': None,
|
||||
'store_fid': None}
|
||||
|
||||
def test_upload_content_to_store(self):
|
||||
self.log_user()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -118,7 +116,7 @@ class FileStoreView(BaseAppView):
|
|||
file_name = db_obj.file_display_name
|
||||
|
||||
response.headers["Content-Disposition"] = (
|
||||
'attachment; filename="{}"'.format(str(file_name))
|
||||
f'attachment; filename="{str(file_name)}"'
|
||||
)
|
||||
response.headers["X-RC-Artifact-Id"] = str(db_obj.file_store_id)
|
||||
response.headers["X-RC-Artifact-Desc"] = str(db_obj.file_description)
|
||||
|
|
@ -135,7 +133,7 @@ class FileStoreView(BaseAppView):
|
|||
if file_obj is None:
|
||||
return {'store_fid': None,
|
||||
'access_path': None,
|
||||
'error': '{} data field is missing'.format(self.upload_key)}
|
||||
'error': f'{self.upload_key} data field is missing'}
|
||||
|
||||
if not hasattr(file_obj, 'filename'):
|
||||
return {'store_fid': None,
|
||||
|
|
@ -154,18 +152,18 @@ class FileStoreView(BaseAppView):
|
|||
except FileNotAllowedException:
|
||||
return {'store_fid': None,
|
||||
'access_path': None,
|
||||
'error': 'File {} is not allowed.'.format(filename)}
|
||||
'error': f'File {filename} is not allowed.'}
|
||||
|
||||
except FileOverSizeException:
|
||||
return {'store_fid': None,
|
||||
'access_path': None,
|
||||
'error': 'File {} is exceeding allowed limit.'.format(filename)}
|
||||
'error': f'File {filename} is exceeding allowed limit.'}
|
||||
|
||||
try:
|
||||
entry = FileStore.create(
|
||||
file_uid=store_uid, filename=metadata["filename"],
|
||||
file_hash=metadata["sha256"], file_size=metadata["size"],
|
||||
file_description=u'upload attachment',
|
||||
file_description='upload attachment',
|
||||
check_acl=False, user_id=self._rhodecode_user.user_id
|
||||
)
|
||||
Session().add(entry)
|
||||
|
|
@ -175,7 +173,7 @@ class FileStoreView(BaseAppView):
|
|||
log.exception('Failed to store file %s', filename)
|
||||
return {'store_fid': None,
|
||||
'access_path': None,
|
||||
'error': 'File {} failed to store in DB.'.format(filename)}
|
||||
'error': f'File {filename} failed to store in DB.'}
|
||||
|
||||
return {'store_fid': store_uid,
|
||||
'access_path': h.route_path('download_file', fid=store_uid)}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2013-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -129,7 +127,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
query = query.filter(Repository.repo_type == repo_type)
|
||||
|
||||
if name_contains:
|
||||
ilike_expression = '%{}%'.format(safe_str(name_contains))
|
||||
ilike_expression = f'%{safe_str(name_contains)}%'
|
||||
query = query.filter(
|
||||
Repository.repo_name.ilike(ilike_expression))
|
||||
query = query.limit(limit)
|
||||
|
|
@ -174,7 +172,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
query = query.order_by(RepoGroup.group_name)
|
||||
|
||||
if name_contains:
|
||||
ilike_expression = u'%{}%'.format(safe_str(name_contains))
|
||||
ilike_expression = f'%{safe_str(name_contains)}%'
|
||||
query = query.filter(
|
||||
RepoGroup.group_name.ilike(ilike_expression))
|
||||
query = query.limit(limit)
|
||||
|
|
@ -216,7 +214,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
.filter(User.username != User.DEFAULT_USER)
|
||||
|
||||
if name_contains:
|
||||
ilike_expression = u'%{}%'.format(safe_str(name_contains))
|
||||
ilike_expression = f'%{safe_str(name_contains)}%'
|
||||
query = query.filter(
|
||||
User.username.ilike(ilike_expression))
|
||||
query = query.limit(limit)
|
||||
|
|
@ -227,7 +225,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
{
|
||||
'id': obj.user_id,
|
||||
'value': org_query,
|
||||
'value_display': 'user: `{}`'.format(obj.username),
|
||||
'value_display': f'user: `{obj.username}`',
|
||||
'type': 'user',
|
||||
'icon_link': h.gravatar_url(obj.email, 30, request=self.request),
|
||||
'url': h.route_path(
|
||||
|
|
@ -256,7 +254,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
.order_by(UserGroup.users_group_name)
|
||||
|
||||
if name_contains:
|
||||
ilike_expression = u'%{}%'.format(safe_str(name_contains))
|
||||
ilike_expression = f'%{safe_str(name_contains)}%'
|
||||
query = query.filter(
|
||||
UserGroup.users_group_name.ilike(ilike_expression))
|
||||
query = query.limit(limit)
|
||||
|
|
@ -267,7 +265,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
{
|
||||
'id': obj.users_group_id,
|
||||
'value': org_query,
|
||||
'value_display': 'user_group: `{}`'.format(obj.users_group_name),
|
||||
'value_display': f'user_group: `{obj.users_group_name}`',
|
||||
'type': 'user_group',
|
||||
'url': h.route_path(
|
||||
'user_group_profile', user_group_name=obj.users_group_name)
|
||||
|
|
@ -308,7 +306,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
query = query.order_by(PullRequest.pull_request_id)
|
||||
|
||||
if name_contains:
|
||||
ilike_expression = u'%{}%'.format(safe_str(name_contains))
|
||||
ilike_expression = f'%{safe_str(name_contains)}%'
|
||||
query = query.filter(or_(
|
||||
cast(PullRequest.pull_request_id, String).ilike(ilike_expression),
|
||||
PullRequest.title.ilike(ilike_expression),
|
||||
|
|
@ -349,7 +347,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
commit_hash = commit_hashes[0]
|
||||
|
||||
result = searcher.search(
|
||||
'commit_id:{}*'.format(commit_hash), 'commit', auth_user,
|
||||
f'commit_id:{commit_hash}*', 'commit', auth_user,
|
||||
repo_name, repo_group_name, raise_on_exc=False)
|
||||
|
||||
commits = []
|
||||
|
|
@ -396,7 +394,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
|
||||
search_path = searcher.escape_specials(file_path)
|
||||
result = searcher.search(
|
||||
'file.raw:*{}*'.format(search_path), 'path', auth_user,
|
||||
f'file.raw:*{search_path}*', 'path', auth_user,
|
||||
repo_name, repo_group_name, raise_on_exc=False)
|
||||
|
||||
files = []
|
||||
|
|
@ -495,7 +493,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
qry = query
|
||||
return {'q': qry, 'type': 'content'}
|
||||
|
||||
label = u'File content search for `{}`'.format(h.escape(query))
|
||||
label = f'File content search for `{h.escape(query)}`'
|
||||
file_qry = {
|
||||
'id': -10,
|
||||
'value': query,
|
||||
|
|
@ -513,7 +511,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
qry = query
|
||||
return {'q': qry, 'type': 'commit'}
|
||||
|
||||
label = u'Commit search for `{}`'.format(h.escape(query))
|
||||
label = f'Commit search for `{h.escape(query)}`'
|
||||
commit_qry = {
|
||||
'id': -20,
|
||||
'value': query,
|
||||
|
|
@ -539,7 +537,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
qry = query
|
||||
return {'q': qry, 'type': 'content'}
|
||||
|
||||
label = u'File content search for `{}`'.format(query)
|
||||
label = f'File content search for `{query}`'
|
||||
file_qry = {
|
||||
'id': -30,
|
||||
'value': query,
|
||||
|
|
@ -557,7 +555,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
qry = query
|
||||
return {'q': qry, 'type': 'commit'}
|
||||
|
||||
label = u'Commit search for `{}`'.format(query)
|
||||
label = f'Commit search for `{query}`'
|
||||
commit_qry = {
|
||||
'id': -40,
|
||||
'value': query,
|
||||
|
|
@ -583,7 +581,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
{
|
||||
'id': -1,
|
||||
'value': query,
|
||||
'value_display': u'File content search for: `{}`'.format(query),
|
||||
'value_display': f'File content search for: `{query}`',
|
||||
'value_icon': '<i class="icon-code"></i>',
|
||||
'type': 'search',
|
||||
'subtype': 'global',
|
||||
|
|
@ -594,7 +592,7 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
{
|
||||
'id': -2,
|
||||
'value': query,
|
||||
'value_display': u'Commit search for: `{}`'.format(query),
|
||||
'value_display': f'Commit search for: `{query}`',
|
||||
'value_icon': '<i class="icon-history"></i>',
|
||||
'type': 'search',
|
||||
'subtype': 'global',
|
||||
|
|
@ -853,4 +851,4 @@ class HomeView(BaseAppView, DataGridAppView):
|
|||
if existing_value != val:
|
||||
self.request.session[key] = val
|
||||
|
||||
return 'stored:{}:{}'.format(key, val)
|
||||
return f'stored:{key}:{val}'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2018-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -370,7 +368,7 @@ class LoginView(BaseAppView):
|
|||
return HTTPFound(self.request.route_path('reset_password'))
|
||||
|
||||
password_reset_form = PasswordResetForm(self.request.translate)()
|
||||
description = u'Generated token for password reset from {}'.format(
|
||||
description = 'Generated token for password reset from {}'.format(
|
||||
datetime.datetime.now().isoformat())
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -87,8 +85,8 @@ class TestMyAccountEdit(TestController):
|
|||
response = self.app.get(route_path('my_account_pullrequests_data'),
|
||||
extra_environ=xhr_header)
|
||||
assert response.json == {
|
||||
u'data': [], u'draw': None,
|
||||
u'recordsFiltered': 0, u'recordsTotal': 0}
|
||||
'data': [], 'draw': None,
|
||||
'recordsFiltered': 0, 'recordsTotal': 0}
|
||||
|
||||
pr = pr_util.create_pull_request(title='TestMyAccountPR')
|
||||
expected = {
|
||||
|
|
@ -115,7 +113,7 @@ class TestMyAccountEdit(TestController):
|
|||
# ('extern_name', {'extern_name': None}),
|
||||
('active', {'active': False}),
|
||||
('active', {'active': True}),
|
||||
('email', {'email': u'some@email.com'}),
|
||||
('email', {'email': 'some@email.com'}),
|
||||
])
|
||||
def test_my_account_update(self, name, attrs, user_util):
|
||||
usr = user_util.create_user(password='qweqwe')
|
||||
|
|
@ -126,8 +124,8 @@ class TestMyAccountEdit(TestController):
|
|||
|
||||
params.update({'password_confirmation': ''})
|
||||
params.update({'new_password': ''})
|
||||
params.update({'extern_type': u'rhodecode'})
|
||||
params.update({'extern_name': u'rhodecode'})
|
||||
params.update({'extern_type': 'rhodecode'})
|
||||
params.update({'extern_name': 'rhodecode'})
|
||||
params.update({'csrf_token': self.csrf_token})
|
||||
|
||||
params.update(attrs)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -107,7 +106,7 @@ class TestChangelogController(TestController):
|
|||
repo=backend.repo_name, branch=branch)
|
||||
assert expected_url in response.location
|
||||
response = response.follow()
|
||||
expected_warning = 'Branch {} is not found.'.format(branch)
|
||||
expected_warning = f'Branch {branch} is not found.'
|
||||
assert expected_warning in response.text
|
||||
|
||||
@pytest.mark.xfail_backends("svn", reason="Depends on branch support")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -996,7 +996,7 @@ class RepoFilesView(RepoAppView):
|
|||
commits_group = ([], _("Changesets"))
|
||||
for commit in commits:
|
||||
branch = ' (%s)' % commit.branch if commit.branch else ''
|
||||
n_desc = 'r{}:{}{}'.format(commit.idx, commit.short_id, branch)
|
||||
n_desc = f'r{commit.idx}:{commit.short_id}{branch}'
|
||||
commits_group[0].append((commit.raw_id, n_desc, 'sha'))
|
||||
history.append(commits_group)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2017-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -53,7 +51,7 @@ class RepoSettingsVcsView(RepoAppView):
|
|||
repo_defaults.update(model.get_repo_settings())
|
||||
|
||||
global_defaults = {
|
||||
'{}_inherited'.format(k): global_defaults[k]
|
||||
f'{k}_inherited': global_defaults[k]
|
||||
for k in global_defaults}
|
||||
|
||||
defaults = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2017-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -207,7 +205,7 @@ class SshWrapper(object):
|
|||
return server.run(tunnel_extras=extras)
|
||||
|
||||
else:
|
||||
raise Exception('Unrecognised VCS: {}'.format(vcs))
|
||||
raise Exception(f'Unrecognised VCS: {vcs}')
|
||||
|
||||
def wrap(self):
|
||||
mode = self.mode
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2013-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -260,11 +259,11 @@ def error_handler(exception, request):
|
|||
|
||||
statsd = request.registry.statsd
|
||||
if statsd and base_response.status_code > 499:
|
||||
exc_type = "{}.{}".format(exception.__class__.__module__, exception.__class__.__name__)
|
||||
exc_type = f"{exception.__class__.__module__}.{exception.__class__.__name__}"
|
||||
statsd.incr('rhodecode_exception_total',
|
||||
tags=["exc_source:web",
|
||||
"http_code:{}".format(base_response.status_code),
|
||||
"type:{}".format(exc_type)])
|
||||
f"http_code:{base_response.status_code}",
|
||||
f"type:{exc_type}"])
|
||||
|
||||
return response
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -69,7 +67,7 @@ def inspect_getargspec():
|
|||
func = func.__wrapped__
|
||||
id_func = id(func)
|
||||
if id_func in memo:
|
||||
raise ValueError('wrapper loop when unwrapping {!r}'.format(f))
|
||||
raise ValueError(f'wrapper loop when unwrapping {f!r}')
|
||||
memo.add(id_func)
|
||||
return func
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -70,7 +69,7 @@ class SettingsMaker(object):
|
|||
os.makedirs(input_val, mode=mode)
|
||||
|
||||
if not os.path.isdir(input_val):
|
||||
raise Exception('Dir at {} does not exist'.format(input_val))
|
||||
raise Exception(f'Dir at {input_val} does not exist')
|
||||
return input_val
|
||||
|
||||
@classmethod
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class RhodecodeEvent(object):
|
|||
self.utc_timestamp = datetime.datetime.utcnow()
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s:(%s)>' % (self.__class__.__name__, self.name)
|
||||
return '<{}:({})>'.format(self.__class__.__name__, self.name)
|
||||
|
||||
def get_request(self):
|
||||
if self._request:
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ class PullRequestEvent(RepoEvent):
|
|||
"""
|
||||
|
||||
def __init__(self, pullrequest):
|
||||
super(PullRequestEvent, self).__init__(pullrequest.target_repo)
|
||||
super().__init__(pullrequest.target_repo)
|
||||
self.pullrequest = pullrequest
|
||||
|
||||
def as_dict(self):
|
||||
from rhodecode.lib.utils2 import md5_safe
|
||||
from rhodecode.model.pull_request import PullRequestModel
|
||||
data = super(PullRequestEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
|
||||
commits = _commits_as_dict(
|
||||
self,
|
||||
|
|
@ -110,7 +110,7 @@ class PullRequestReviewEvent(PullRequestEvent):
|
|||
'pull requests has changed to other.')
|
||||
|
||||
def __init__(self, pullrequest, status):
|
||||
super(PullRequestReviewEvent, self).__init__(pullrequest)
|
||||
super().__init__(pullrequest)
|
||||
self.status = status
|
||||
|
||||
|
||||
|
|
@ -136,12 +136,12 @@ class PullRequestCommentEvent(PullRequestEvent):
|
|||
'in the pull request')
|
||||
|
||||
def __init__(self, pullrequest, comment):
|
||||
super(PullRequestCommentEvent, self).__init__(pullrequest)
|
||||
super().__init__(pullrequest)
|
||||
self.comment = comment
|
||||
|
||||
def as_dict(self):
|
||||
from rhodecode.model.comment import CommentsModel
|
||||
data = super(PullRequestCommentEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
|
||||
status = None
|
||||
if self.comment.status_change:
|
||||
|
|
@ -175,12 +175,12 @@ class PullRequestCommentEditEvent(PullRequestEvent):
|
|||
'in the pull request')
|
||||
|
||||
def __init__(self, pullrequest, comment):
|
||||
super(PullRequestCommentEditEvent, self).__init__(pullrequest)
|
||||
super().__init__(pullrequest)
|
||||
self.comment = comment
|
||||
|
||||
def as_dict(self):
|
||||
from rhodecode.model.comment import CommentsModel
|
||||
data = super(PullRequestCommentEditEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
|
||||
status = None
|
||||
if self.comment.status_change:
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def _commits_as_dict(event, commit_ids, repos):
|
|||
'raw_id': commit_id, 'short_id': commit_id,
|
||||
'branch': None,
|
||||
'git_ref_change': 'tag_add',
|
||||
'message': 'Added new tag {}'.format(raw_id),
|
||||
'message': f'Added new tag {raw_id}',
|
||||
'author': event.actor.full_contact,
|
||||
'date': datetime.datetime.now(),
|
||||
'refs': {
|
||||
|
|
@ -86,7 +86,7 @@ def _commits_as_dict(event, commit_ids, repos):
|
|||
'raw_id': commit_id, 'short_id': commit_id,
|
||||
'branch': None,
|
||||
'git_ref_change': 'branch_delete',
|
||||
'message': 'Deleted branch {}'.format(raw_id),
|
||||
'message': f'Deleted branch {raw_id}',
|
||||
'author': event.actor.full_contact,
|
||||
'date': datetime.datetime.now(),
|
||||
'refs': {
|
||||
|
|
@ -155,12 +155,12 @@ class RepoEvent(RhodeCodeIntegrationEvent):
|
|||
"""
|
||||
|
||||
def __init__(self, repo):
|
||||
super(RepoEvent, self).__init__()
|
||||
super().__init__()
|
||||
self.repo = repo
|
||||
|
||||
def as_dict(self):
|
||||
from rhodecode.model.repo import RepoModel
|
||||
data = super(RepoEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
|
||||
extra_fields = collections.OrderedDict()
|
||||
for field in self.repo.extra_fields:
|
||||
|
|
@ -193,12 +193,12 @@ class RepoCommitCommentEvent(RepoEvent):
|
|||
'on commit inside a repository')
|
||||
|
||||
def __init__(self, repo, commit, comment):
|
||||
super(RepoCommitCommentEvent, self).__init__(repo)
|
||||
super().__init__(repo)
|
||||
self.commit = commit
|
||||
self.comment = comment
|
||||
|
||||
def as_dict(self):
|
||||
data = super(RepoCommitCommentEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
data['commit'] = {
|
||||
'commit_id': self.commit.raw_id,
|
||||
'commit_message': self.commit.message,
|
||||
|
|
@ -228,12 +228,12 @@ class RepoCommitCommentEditEvent(RepoEvent):
|
|||
'on commit inside a repository')
|
||||
|
||||
def __init__(self, repo, commit, comment):
|
||||
super(RepoCommitCommentEditEvent, self).__init__(repo)
|
||||
super().__init__(repo)
|
||||
self.commit = commit
|
||||
self.comment = comment
|
||||
|
||||
def as_dict(self):
|
||||
data = super(RepoCommitCommentEditEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
data['commit'] = {
|
||||
'commit_id': self.commit.raw_id,
|
||||
'commit_message': self.commit.message,
|
||||
|
|
@ -300,7 +300,7 @@ class RepoVCSEvent(RepoEvent):
|
|||
if not self.repo:
|
||||
raise Exception('repo by this name %s does not exist' % repo_name)
|
||||
self.extras = extras
|
||||
super(RepoVCSEvent, self).__init__(self.repo)
|
||||
super().__init__(self.repo)
|
||||
|
||||
@property
|
||||
def actor(self):
|
||||
|
|
@ -366,12 +366,12 @@ class RepoPushEvent(RepoVCSEvent):
|
|||
'pushed to a repository')
|
||||
|
||||
def __init__(self, repo_name, pushed_commit_ids, extras):
|
||||
super(RepoPushEvent, self).__init__(repo_name, extras)
|
||||
super().__init__(repo_name, extras)
|
||||
self.pushed_commit_ids = pushed_commit_ids
|
||||
self.new_refs = extras.new_refs
|
||||
|
||||
def as_dict(self):
|
||||
data = super(RepoPushEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
|
||||
def branch_url(branch_name):
|
||||
return '{}/changelog?branch={}'.format(
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ class RepoGroupEvent(RhodeCodeIntegrationEvent):
|
|||
"""
|
||||
|
||||
def __init__(self, repo_group):
|
||||
super(RepoGroupEvent, self).__init__()
|
||||
super().__init__()
|
||||
self.repo_group = repo_group
|
||||
|
||||
def as_dict(self):
|
||||
data = super(RepoGroupEvent, self).as_dict()
|
||||
data = super().as_dict()
|
||||
data.update({
|
||||
'repo_group': {
|
||||
'group_id': self.repo_group.group_id,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class UserRegistered(RhodeCodeIntegrationEvent):
|
|||
display_name = lazy_ugettext('user registered')
|
||||
|
||||
def __init__(self, user, session):
|
||||
super(UserRegistered, self).__init__()
|
||||
super().__init__()
|
||||
self.user = user
|
||||
self.session = session
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class UserPreCreate(RhodeCodeIntegrationEvent):
|
|||
display_name = lazy_ugettext('user pre create')
|
||||
|
||||
def __init__(self, user_data):
|
||||
super(UserPreCreate, self).__init__()
|
||||
super().__init__()
|
||||
self.user_data = user_data
|
||||
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class UserPostCreate(RhodeCodeIntegrationEvent):
|
|||
display_name = lazy_ugettext('user post create')
|
||||
|
||||
def __init__(self, user_data):
|
||||
super(UserPostCreate, self).__init__()
|
||||
super().__init__()
|
||||
self.user_data = user_data
|
||||
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class UserPreUpdate(RhodeCodeIntegrationEvent):
|
|||
display_name = lazy_ugettext('user pre update')
|
||||
|
||||
def __init__(self, user, user_data):
|
||||
super(UserPreUpdate, self).__init__()
|
||||
super().__init__()
|
||||
self.user = user
|
||||
self.user_data = user_data
|
||||
|
||||
|
|
@ -100,5 +100,5 @@ class UserPermissionsChange(RhodecodeEvent):
|
|||
display_name = lazy_ugettext('user permissions change')
|
||||
|
||||
def __init__(self, user_ids):
|
||||
super(UserPermissionsChange, self).__init__()
|
||||
super().__init__()
|
||||
self.user_ids = user_ids
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2016-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -43,7 +41,7 @@ class UrlTmpl(string.Template):
|
|||
def safe_substitute(self, **kws):
|
||||
# url encode the kw for usage in url
|
||||
kws = {k: urllib.parse.quote(safe_str(v)) for k, v in kws.items()}
|
||||
return super(UrlTmpl, self).safe_substitute(**kws)
|
||||
return super().safe_substitute(**kws)
|
||||
|
||||
|
||||
class IntegrationTypeBase(object):
|
||||
|
|
@ -265,7 +263,7 @@ class WebhookDataHandler(CommitParsingDataHandler):
|
|||
|
||||
extra_vars = {}
|
||||
for extra_key, extra_val in data['repo']['extra_fields'].items():
|
||||
extra_vars['extra__{}'.format(extra_key)] = extra_val
|
||||
extra_vars[f'extra__{extra_key}'] = extra_val
|
||||
common_vars.update(extra_vars)
|
||||
|
||||
template_url = self.template_url.replace('${extra:', '${extra__')
|
||||
|
|
@ -388,7 +386,7 @@ class WebhookDataHandler(CommitParsingDataHandler):
|
|||
return self.pull_request_event_handler(event, data)
|
||||
else:
|
||||
raise ValueError(
|
||||
'event type `{}` has no handler defined'.format(event.__class__))
|
||||
f'event type `{event.__class__}` has no handler defined')
|
||||
|
||||
|
||||
def get_auth(settings):
|
||||
|
|
@ -408,7 +406,7 @@ def get_url_vars(url_vars):
|
|||
items = []
|
||||
|
||||
for section, section_items in url_vars:
|
||||
items.append('\n*{}*'.format(section))
|
||||
items.append(f'\n*{section}*')
|
||||
for key, explanation in section_items:
|
||||
items.append(' {} - {}'.format('${' + key + '}', explanation))
|
||||
return '\n'.join(items)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -128,7 +126,7 @@ class HipchatIntegrationType(IntegrationTypeBase, CommitParsingDataHandler):
|
|||
|
||||
data = event.as_dict()
|
||||
|
||||
text = '<b>%s<b> caused a <b>%s</b> event' % (
|
||||
text = '<b>{}<b> caused a <b>{}</b> event'.format(
|
||||
data['actor']['username'], event.name)
|
||||
|
||||
if isinstance(event, events.PullRequestCommentEvent):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -235,7 +233,7 @@ def post_to_webhook(url_calls, settings):
|
|||
"""
|
||||
|
||||
call_headers = {
|
||||
'User-Agent': 'RhodeCode-webhook-caller/{}'.format(rhodecode.__version__)
|
||||
'User-Agent': f'RhodeCode-webhook-caller/{rhodecode.__version__}'
|
||||
} # updated below with custom ones, allows override
|
||||
|
||||
auth = get_auth(settings)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -48,7 +46,7 @@ class IntegrationSettingsViewBase(BaseAppView):
|
|||
"""
|
||||
|
||||
def __init__(self, context, request):
|
||||
super(IntegrationSettingsViewBase, self).__init__(context, request)
|
||||
super().__init__(context, request)
|
||||
self._load_view_context()
|
||||
|
||||
def _load_view_context(self):
|
||||
|
|
@ -112,7 +110,7 @@ class IntegrationSettingsViewBase(BaseAppView):
|
|||
|
||||
def _get_local_tmpl_context(self, include_app_defaults=True):
|
||||
_ = self.request.translate
|
||||
c = super(IntegrationSettingsViewBase, self)._get_local_tmpl_context(
|
||||
c = super()._get_local_tmpl_context(
|
||||
include_app_defaults=include_app_defaults)
|
||||
c.active = 'integrations'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
# Copyright (C) 2012-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
"""
|
||||
Helper functions for use with :class:`Authomatic`.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# Copyright (C) 2010-2023 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue