~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/models.py

  • Committer: Tarmac
  • Author(s): Brad Crittenden
  • Date: 2014-04-02 18:25:54 UTC
  • mfrom: (497.1.1 add-maintainers)
  • Revision ID: tarmac-20140402182554-h4fo6e0qnroitzni
Add a 'maintainer's field.

It was decided on the mailing list that the 'maintainer' field should be
renamed to 'maintainers' to make it clear that there can be more than one.
Note the old 'maintainer' field was capable of being a single entity or a list
just fine.

So for backward compatability, 'maintainer' is preserved, 'maintainers' is
added and the actual value used is the union of the two, with duplicates
removed.  

On the charm page the heading has been changed to 'Maintainer(s)" and an
unordered list is used to present the names.

https://codereview.appspot.com/83620043/

R=rharding.

Approved by Juju Gui Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
371
371
        'i_requires': [],
372
372
        'label': '',
373
373
        'maintainer': '',
 
374
        'maintainers': '',
374
375
        'provides': {},
375
376
        'requires': {},
376
377
        'revision': 0,
670
671
        ]
671
672
 
672
673
    @property
673
 
    def maintainer(self):
674
 
        """The maintainer of this charm.
 
674
    def maintainers(self):
 
675
        """The maintainers of this charm.
675
676
 
676
 
        The maintainer is a string or a list of strings in the RFC2822 format.
 
677
        This property is a sorted list comprised of the union of
 
678
        'maintainer' and 'maintainers' fields, de-duplicated.
677
679
        """
678
 
        return self._representation['maintainer']
 
680
        # The 'maintainer' field is deprecated but not yet phased out.
 
681
        maintainers = set()
 
682
        for key in ('maintainer', 'maintainers'):
 
683
            val = self._representation[key]
 
684
            if val:
 
685
                if isinstance(val, basestring):
 
686
                    maintainers.add(val)
 
687
                else:
 
688
                    maintainers.update(val)
 
689
        return sorted(maintainers)
679
690
 
680
691
    @property
681
692
    def subordinate(self):