Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OPUS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Servillat Mathieu
OPUS
Commits
1b0b97b5
Commit
1b0b97b5
authored
1 year ago
by
Servillat Mathieu
Browse files
Options
Downloads
Plain Diff
Merge branch 'flask233' into 'master'
fix issue with Flask 2.3.3 See merge request
!4
parents
d2765299
19b17e20
No related branches found
No related tags found
1 merge request
!4
fix issue with Flask 2.3.3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
requirements.txt
+2
-2
2 additions, 2 deletions
requirements.txt
requirements_conda.txt
+2
-2
2 additions, 2 deletions
requirements_conda.txt
uws_client/uws_client.py
+39
-31
39 additions, 31 deletions
uws_client/uws_client.py
with
43 additions
and
35 deletions
requirements.txt
+
2
−
2
View file @
1b0b97b5
...
...
@@ -7,9 +7,9 @@ requests
lxml
webtest
pyyaml
prov
==1.5.3
prov
voprov
flask
==2.2.5
flask
flask-sqlalchemy
flask-security-too
authlib
...
...
This diff is collapsed.
Click to expand it.
requirements_conda.txt
+
2
−
2
View file @
1b0b97b5
...
...
@@ -8,8 +8,8 @@ requests
lxml
webtest
pyyaml
prov
==1.5.3
flask
==2.2.5
prov
flask
flask-sqlalchemy
flask-security-too
authlib
...
...
This diff is collapsed.
Click to expand it.
uws_client/uws_client.py
+
39
−
31
View file @
1b0b97b5
...
...
@@ -88,6 +88,38 @@ app.config.from_object(__name__) # load config from this file
mail
=
Mail
(
app
)
# ----------
# Load/store editable config
def
load_config
():
if
os
.
path
.
isfile
(
CONFIG_FILE
):
logger
.
info
(
'
Loading editable config (overwrites some variables)
'
)
with
open
(
CONFIG_FILE
,
'
r
'
)
as
cf
:
econf
=
yaml
.
safe_load
(
cf
)
app
.
config
.
update
(
econf
)
else
:
save_config
()
def
save_config
():
logger
.
info
(
'
Saving editable config
'
)
with
open
(
CONFIG_FILE
,
'
w
'
)
as
cf
:
econf
=
{
k
:
app
.
config
[
k
]
for
k
in
EDITABLE_CONFIG
if
k
in
app
.
config
}
yaml
.
dump
(
econf
,
cf
,
default_flow_style
=
False
)
def
update_config
(
key
,
value
):
if
key
in
EDITABLE_CONFIG
:
app
.
config
[
key
]
=
value
save_config
()
# Loads editable config at app start (before_first_request):
with
app
.
app_context
():
load_config
()
# ----------
# User DB
...
...
@@ -262,39 +294,10 @@ def oidc_logout():
return
redirect
(
url_for
(
"
home
"
))
# ----------
# Load/store editable config
@app.before_first_request
def
load_config
():
logger
.
debug
(
'
Load editable config
'
)
if
os
.
path
.
isfile
(
CONFIG_FILE
):
with
open
(
CONFIG_FILE
,
'
r
'
)
as
cf
:
econf
=
yaml
.
safe_load
(
cf
)
app
.
config
.
update
(
econf
)
else
:
save_config
()
def
save_config
():
logger
.
debug
(
'
Save editable config
'
)
with
open
(
CONFIG_FILE
,
'
w
'
)
as
cf
:
econf
=
{
k
:
app
.
config
[
k
]
for
k
in
EDITABLE_CONFIG
if
k
in
app
.
config
}
yaml
.
dump
(
econf
,
cf
,
default_flow_style
=
False
)
def
update_config
(
key
,
value
):
if
key
in
EDITABLE_CONFIG
:
app
.
config
[
key
]
=
value
save_config
()
# ----------
# Create default database
@app.before_first_request
def
create_db
():
try
:
db
.
create_all
()
...
...
@@ -318,7 +321,7 @@ def create_db():
name
=
'
job_list
'
,
description
=
'
Access to job list
'
,
)
# Create admin user
# Create admin user
if not exist
if
not
user_datastore
.
find_user
(
id
=
ADMIN_NAME
):
user_datastore
.
create_user
(
email
=
ADMIN_NAME
,
...
...
@@ -326,7 +329,7 @@ def create_db():
active
=
True
,
roles
=
[
'
admin
'
,
'
job_definition
'
,
'
job_list
'
],
)
# Create demo user
# Create demo user
if not exist
if
not
user_datastore
.
find_user
(
id
=
TESTUSER_NAME
):
user_datastore
.
create_user
(
email
=
TESTUSER_NAME
,
...
...
@@ -341,6 +344,11 @@ def create_db():
logger
.
warning
(
str
(
e
))
# Create or Update DB at app start (before_first_request):
with
app
.
app_context
():
create_db
()
# ----------
# Create Admin pages
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment