~fabricematrat/charmworld/redirect-charm

« back to all changes in this revision

Viewing changes to charmworld/models.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:
228
228
 
229
229
 
230
230
def construct_charm_id(charm_data, use_revision=True):
 
231
    """Build the ID of a charm from a mapping of that charm's attributes."""
231
232
    elements = [charm_data['owner'], charm_data['series'], charm_data['name']]
232
233
    if use_revision:
233
234
        elements.append('%d' % charm_data['store_data']['revision'])
1288
1289
    def create_collection(self):
1289
1290
        self.collection.database.create_collection(self.collection.name)
1290
1291
 
 
1292
    @staticmethod
 
1293
    def make_all_revisions_query(charm_data):
 
1294
        return {
 
1295
            'owner': charm_data['owner'],
 
1296
            'series': charm_data['series'],
 
1297
            'name': charm_data['name'],
 
1298
        }
 
1299
 
 
1300
    def find_all_revisions(self, charm_data):
 
1301
        query = self.make_all_revisions_query(charm_data)
 
1302
        return list(self.collection.find(query))
 
1303
 
 
1304
 
1291
1305
 
1292
1306
def get_basket_info(revno, **data):
1293
1307
    owner_segment = '~%s' % data['owner']