Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amundsen_dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Surendar Reddy Mangannagari
amundsen_dev
Commits
a8225f42
Unverified
Commit
a8225f42
authored
May 19, 2020
by
Tamika Tannis
Committed by
GitHub
May 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update profile url workaround (#459)
* Try something for test * Update fix * Update fix * Lint fix
parent
c85fb5ea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
user.py
amundsen_application/models/user.py
+18
-3
No files found.
amundsen_application/models/user.py
View file @
a8225f42
from
typing
import
Dict
from
typing
import
Dict
,
Optional
from
amundsen_common.models.user
import
UserSchema
,
User
from
amundsen_common.models.user
import
UserSchema
,
User
from
flask
import
current_app
as
app
from
flask
import
current_app
as
app
from
marshmallow
import
ValidationError
from
marshmallow
import
ValidationError
def
_str_no_value
(
s
:
Optional
[
str
])
->
bool
:
# Returns True if the given string is None or empty
if
not
s
:
return
True
if
len
(
s
.
strip
())
==
0
:
return
True
return
False
def
load_user
(
user_data
:
Dict
)
->
User
:
def
load_user
(
user_data
:
Dict
)
->
User
:
try
:
try
:
schema
=
UserSchema
()
schema
=
UserSchema
()
# To make sure we pass frontend configuration to amundsen common models
# In order to call 'GET_PROFILE_URL' we make sure the user id exists
user_data
[
'GET_PROFILE_URL'
]
=
app
.
config
[
'GET_PROFILE_URL'
]
if
_str_no_value
(
user_data
.
get
(
'user_id'
)):
user_data
[
'user_id'
]
=
user_data
.
get
(
'email'
)
# Add profile_url from optional 'GET_PROFILE_URL' configuration method.
# This methods currently exists for the case where the 'profile_url' is not included
# in the user metadata.
if
_str_no_value
(
user_data
.
get
(
'profile_url'
))
and
app
.
config
[
'GET_PROFILE_URL'
]:
user_data
[
'profile_url'
]
=
app
.
config
[
'GET_PROFILE_URL'
](
user_data
[
'user_id'
])
data
,
errors
=
schema
.
load
(
user_data
)
data
,
errors
=
schema
.
load
(
user_data
)
return
data
return
data
except
ValidationError
as
err
:
except
ValidationError
as
err
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment