~jcsackett/charmworld/bac-tag-constraints

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright 2013 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import logging

from charmworld.models import (
    options_to_storage,
    FeaturedSource,
)


def upgrade(db, index_client):
    featured_data = index_client.api_search(filters={'is_featured': [True]})
    featured = FeaturedSource(db.featured)
    for charm_data in featured_data:
        if charm_data.get('is_featured'):
            featured.set_featured(charm_data, 'charm')