~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/views/charms.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:
73
73
                     'description': v.get('description', u'')}
74
74
                d_config.append(d)
75
75
 
76
 
        charm_data['maintainer_name'] = name_filter(self.maintainer)
 
76
    @property
 
77
    def maintainer_names(self):
 
78
        names = []
 
79
        for maintainer in self.maintainers:
 
80
            names.append(name_filter(maintainer))
 
81
        return names
77
82
 
78
83
    @property
79
84
    def d_provides(self):
176
181
 
177
182
def _json_charm(charm):
178
183
    charm_config = charm.config
179
 
    charm = dict(charm._representation)
 
184
    charm_data = dict(charm._representation)
180
185
    # Reformat config into old internal representation.
181
 
    charm['config'] = charm_config
182
 
    charm_keys = set(charm.keys())
 
186
    charm_data['config'] = charm_config
 
187
    charm_keys = set(charm_data.keys())
183
188
    for k in SANITIZE.intersection(charm_keys):
184
 
        del charm[k]
 
189
        del charm_data[k]
185
190
    return Response(
186
 
        json.dumps(charm, sort_keys=True, indent=2),
 
191
        json.dumps(charm_data, sort_keys=True, indent=2),
187
192
        headerlist=[
188
193
            ("Access-Control-Allow-Origin", "*"),
189
194
            ("Access-Control-Allow-Headers", "X-Requested-With"),