示例#1
0
    def _contributor_multiple_role_setter(self, role: str, value: List[str]) -> None:
        '''
        set multiple names for a particular role, replacing the people
        already in those roles.

        see composers.setter (plural) property for an example.
        '''
        existing_contributors = self.getContributorsByRole(role)
        if existing_contributors:
            for existing in existing_contributors:
                self.contributors.remove(existing)

        for v in value:
            contrib = Contributor(role=role, name=v)
            self.addContributor(contrib)
示例#2
0
    def _contributor_role_setter(self, role: str, name: str) -> None:
        '''
        set the name for a particular role, adding a new contributor
        in the process if none exists for that role.

        see composer.setter property for an example
        '''
        c = None

        result = self.getContributorsByRole(role)
        if result is not None:
            c = result[0]
        else:
            c = Contributor()
            c.role = role
            self.contributors.append(c)

        c.name = name
示例#3
0
 def composer(self, value):
     c = Contributor()
     c.name = value
     c.role = 'composer'
     self.contributors.append(c)