~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/migrations/versions/013_migrate_featured.py

[r=sinzui][bug=1208477][author=abentley] Remove doctype attribute.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2013 Canonical Ltd.  This software is licensed under the
2
 
# GNU Affero General Public License version 3 (see the file LICENSE).
3
 
 
4
 
import logging
5
 
 
6
 
from charmworld.models import (
7
 
    options_to_storage,
8
 
    FeaturedSource,
9
 
)
10
 
 
11
 
 
12
 
def upgrade(db, index_client):
13
 
    featured_data = index_client.api_search(filters={'is_featured': [True]})
14
 
    featured = FeaturedSource(db.featured)
15
 
    for charm_data in featured_data:
16
 
        if charm_data.get('is_featured'):
17
 
            featured.set_featured(charm_data, 'charm')