RSS

(root)/packagedb/0.5.x : 613 : pkgdb/letter_paginator.py

To get this branch, use:
bzr branch /bzr/packagedb/0.5.x

« back to all changes in this revision

Viewing changes to pkgdb/letter_paginator.py

pingou at pingoured
2011-08-20 16:54:14
Revision ID: pingou@pingoured.fr-20110820165414-fbvjdibaiqiyw7s9
Update acls, users and letter_paginator to return collection information

- all three files now return a collectn_map
- letter_paginator now also returns collection information for each package

Show diffs side-by-side

added added

removed removed

111
111
            else:
112
112
                packages = PackageBuild.query.all() #pylint:disable-msg=E1101
113
113
 
 
114
        # generate the statusMap with statuscode and collectionid
114
115
        statuses = set()
 
116
        collectn_map = {}
 
117
        pkg_list = []
115
118
        for pkg in packages:
 
119
            pkg.json_props = {'Package':('listings',)}
 
120
            pkg_list.append(pkg)
116
121
            statuses.add(pkg.statuscode)
 
122
            for pkglisting in pkg.listings:
 
123
                if pkglisting.collection.collectionid not in collectn_map:
 
124
                    collectn_map[pkglisting.collection.collectionid] = \
 
125
                        pkglisting.collection.branchname
117
126
        statusMap = dict([(statuscode, STATUS[statuscode]) for statuscode in statuses])
118
127
 
119
128
        searchwords = searchwords.replace('%','*')
120
129
 
121
130
        return dict(title=_('%(app)s -- Packages Overview %(mode)s') % {
122
131
            'app': self.app_title, 'mode': mode.strip('/')},
123
 
                       searchwords=searchwords, packages=packages, mode=mode,
124
 
                       bzurl=bzUrl, statusMap=statusMap)
 
132
                       searchwords=searchwords, packages=pkg_list, mode=mode,
 
133
                       bzurl=bzUrl, statusMap=statusMap, collectn_map=collectn_map)

Loggerhead 1.18.1 is a web-based interface for Bazaar branches