~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/forms/featured.py

  • Committer: Benji York
  • Date: 2013-11-18 20:38:47 UTC
  • mto: This revision was merged to the branch mainline in revision 465.
  • Revision ID: benji@benjiyork.com-20131118203847-2mfs1w7b8aqy64mr
checkpoint

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2012-2014 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2012, 2013 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
__metaclass__ = type
10
10
    SchemaNode,
11
11
)
12
12
 
13
 
from charmworld.search import BUNDLE
14
 
 
15
 
 
16
 
def get_schema(kind):
17
 
    """Based on the kind return the right schema."""
18
 
    if kind == BUNDLE:
19
 
        return BundleFeaturedness()
20
 
    return CharmFeaturedness()
21
 
 
22
13
 
23
14
class CharmFeaturedness(MappingSchema):
24
 
    is_featured = SchemaNode(
25
 
        Boolean(), title='Feature this charm',
26
 
        missing=False)
27
 
 
28
 
 
29
 
class BundleFeaturedness(MappingSchema):
30
 
    is_featured = SchemaNode(
31
 
        Boolean(), title='Feature this bundle',
32
 
        missing=False)
 
15
    is_featured = SchemaNode(Boolean(), title='Feature this charm',
 
16
                             missing=False)