Skip to content

Commit

Permalink
Merge pull request #33 from hydroshare/user_id_hotfix
Browse files Browse the repository at this point in the history
fix hydroshare_user_id parsing
  • Loading branch information
sblack-usu authored Jun 15, 2022
2 parents 0faa843 + 7088208 commit ba248af
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hsmodels/schemas/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def schema_extra(schema: Dict[str, Any], model) -> None:
"title": "Key-Value",
"description": "A key-value pair",
"default": [],
"properties": {"key": {"type": "string"}, "value": {"type": "string"}}
"properties": {"key": {"type": "string"}, "value": {"type": "string"}},
}


Expand Down
6 changes: 4 additions & 2 deletions hsmodels/schemas/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ class Config:
@classmethod
def from_user(cls, user):
user_dict = user.dict()
user_dict["description"] = user.url.path
hydroshare_user_id = user.url.path.split("/")[-2]
user_dict["hydroshare_user_id"] = hydroshare_user_id
if user.website:
user_dict["homepage"] = user.website

Expand Down Expand Up @@ -232,7 +233,8 @@ def from_user(cls, user):
:return: a Contributor
"""
user_dict = user.dict()
user_dict["hydroshare_user_id"] = user.id
hydroshare_user_id = user.url.path.split("/")[-2]
user_dict["hydroshare_user_id"] = hydroshare_user_id
if user.website:
user_dict["homepage"] = user.website

Expand Down
2 changes: 1 addition & 1 deletion hsmodels/schemas/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
split_coverages,
split_dates,
)
from hsmodels.schemas.validators import list_not_empty, parse_identifier, parse_spatial_coverage
from hsmodels.schemas.validators import list_not_empty, parse_identifier, parse_spatial_coverage


class ResourceMetadataIn(BaseMetadata):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='hsmodels',
version='0.5.1',
version='0.5.2',
packages=find_packages(include=['hsmodels', 'hsmodels.*', 'hsmodels.schemas.*', 'hsmodels.schemas.rdf.*'],
exclude=("tests",)),
install_requires=[
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,5 @@ def test_dictionary_field(additional_metadata_field):
"title": "Key-Value",
"description": "A key-value pair",
"default": [],
"properties": {"key": {"type": "string"}, "value": {"type": "string"}}
"properties": {"key": {"type": "string"}, "value": {"type": "string"}},
}

0 comments on commit ba248af

Please sign in to comment.