Skip to content

Commit

Permalink
Support description mapping for CKAN
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Apr 19, 2024
1 parent 918bc0c commit 0b350d5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dplib/plugins/ckan/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ def to_dp(self) -> Resource:
Returns:
Data Resource
"""
# Path/Name
resource = Resource(path=self.name, name=slugify_name(self.name))

# Description
if self.description:
resource.description = self.description

# Format
if self.format:
resource.format = self.format.lower()
Expand Down Expand Up @@ -65,6 +70,10 @@ def from_dp(cls, resource: Resource) -> Optional[CkanResource]:
# Path
ckan = CkanResource(name=resource.path)

# Description
if resource.description:
ckan.description = resource.description

# Format
if resource.format:
ckan.format = resource.format.upper()
Expand Down

0 comments on commit 0b350d5

Please sign in to comment.