Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Commit

Permalink
Use Python 3.7 compatible dependencies and flask-session fix
Browse files Browse the repository at this point in the history
  • Loading branch information
apakulov-stripe committed Feb 5, 2020
1 parent 39823f3 commit c23cd8e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion confidant/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

if app.config.get('REDIS_URL'):
import redis
from flask.ext.session import Session
from flask_session import Session
app.config['SESSION_REDIS'] = redis.Redis.from_url(
app.config['REDIS_URL']
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
$scope.shown = true;
}

$scope.groups = function(usergroups) {
return [""].concat(usergroups);
}
$scope.groups = function(usergroups) {
return [""].concat(usergroups);
}

$scope.showValue = function(credentialPair) {
if (credentialPair.shown) {
Expand Down
12 changes: 10 additions & 2 deletions confidant/routes/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,10 @@ def _pair_key_conflicts_for_services(_id, credential_keys, services):
return conflicts


def _lowercase_credential_pairs(credential_pairs):
return {i.lower(): j for i, j in credential_pairs.items()}


@app.route('/v1/credentials', methods=['POST'])
@authnz.require_auth
@authnz.require_csrf_token
Expand All @@ -688,7 +692,8 @@ def create_credential():
if app.config.get('USE_GROUPS'):
if data.get('group') and not authnz.user_is_member(data.get('group')):
return jsonify({'error': 'Must be a member of the destination group'}), 400
credential_pairs = data['credential_pairs']
# Ensure credential pair keys are lowercase
credential_pairs = _lowercase_credential_pairs(data['credential_pairs'])
_check, ret = _check_credential_pair_values(credential_pairs)
if not _check:
return jsonify(ret), 400
Expand Down Expand Up @@ -789,7 +794,10 @@ def update_credential(id):
return jsonify({'error': 'metadata must be a dict'}), 400
services = _get_services_for_credential(id)
if 'credential_pairs' in data:
credential_pairs = data['credential_pairs']
# Ensure credential pair keys are lowercase
credential_pairs = _lowercase_credential_pairs(
data['credential_pairs']
)
_check, ret = _check_credential_pair_values(credential_pairs)
if not _check:
return jsonify(ret), 400
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cffi>1.10.0
# License: BSD
# Upstream url: https://github.com/fengsp/flask-session
# Use: For shared sessions
Flask-Session==0.2.1
Flask-Session==0.2.3

# Redis
# License: MIT
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ entrypoints==0.3 # via flake8
enum34==1.1.6
flake8==3.7.8
flask-script==2.0.5
flask-session==0.2.1
flask-session==0.2.3
flask-sslify==0.1.5
flask==1.1.1
funcsigs==1.0.2 # via mock
Expand Down
6 changes: 3 additions & 3 deletions requirements3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ docutils==0.15.2 # via botocore
entrypoints==0.3 # via flake8
flake8==3.7.8
flask-script==2.0.5
flask-session==0.2.1
flask-session==0.2.3
flask-sslify==0.1.5
flask==1.1.1
gevent==1.2.1
greenlet==0.4.12
gevent==1.4.0 # force this version for py3.7
greenlet==0.4.15 # force this version for py3.7
guard==1.0.1
gunicorn==19.9.0
idna==2.8 # via requests
Expand Down

0 comments on commit c23cd8e

Please sign in to comment.