Skip to content

Commit

Permalink
Merge pull request #37 from zalf-rdm/attach-upstream
Browse files Browse the repository at this point in the history
removed artifacts
  • Loading branch information
mwallschlaeger authored Oct 20, 2023
2 parents d73e9bf + ec5d105 commit e94caea
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2041,45 +2041,6 @@ def _get_metadata_author(self):
def _set_metadata_author(self, user_profile):
return self.__set_contact_role_element__(user_profile=user_profile, role="author")

def _get_contact_role_element(self, role: str) -> ContactRole:
"""
generell getter of for all contact roles except owner
param role (str): string coresponding to ROLE_VALUES in geonode/people/enumarations, defining which propery is requested
return (ContactRole): returns the requested contact role from the database
"""
try:
cr = ContactRole.objects.get(role=role, resource=self).contact
except ContactRole.DoesNotExist:
cr = None
return cr

def _set_contact_role_element(self, contact_role: ContactRole, role: str) -> ContactRole:
"""
generell setter for all contact roles except owner in resource base
param contact_role (ContactRole):
param role (str): string coresponding to ROLE_VALUES in geonode/people/enumarations, defining which propery is to set
return (ContactRole): returns the requested contact role from the database
"""
ContactRole.objects.filter(role=role, resource=self).delete()
# create the new assignation
ContactRole.objects.create(role=role, resource=self, contact=contact_role)

def _get_poc(self):
return self._get_contact_role_element(role="pointOfContact")

def _set_poc(self, contact_role: ContactRole):
return self._set_contact_role_element(contact_role=contact_role, role="pointOfContact")

poc = property(_get_poc, _set_poc)

def _get_metadata_author(self):
return self._get_contact_role_element(role="author")

def _set_metadata_author(self, contact_role: ContactRole):
return self._set_contact_role_element(contact_role=contact_role, role="author")

metadata_author = property(_get_metadata_author, _set_metadata_author)

@property
Expand Down

0 comments on commit e94caea

Please sign in to comment.