コード例 #1
0
    def name(self, collctn):
        '''Return a page with information on a particular Collection

        :arg collctn: Collection shortname
        '''
        ### FIXME: Want to return additional info:
        # date it was created (join log table: creation date)
        # The initial import doesn't have this information, though.
        try:
            #pylint:disable-msg=E1101
            collection = Collection.by_simple_name(collctn)
        except InvalidRequestError:
            # Either the name doesn't exist or somehow it references more than
            # one value
            flash(
                _('The collection name you were linked to, %(collctn)s,'
                  ' does not exist.  If you received this error from'
                  ' a link on the fedoraproject.org website, please'
                  ' report it.') % {'collctn': collctn})
            if request_format() == 'json':
                error = dict(exc='InvalidCollection')
            else:
                error = dict(title=_('%(app)s -- Invalid Collection Name') %
                             {'app': self.app_title},
                             tg_template='pkgdb.templates.errors')
            return error

        # Why do we reformat the data returned from the database?
        # 1) We don't need all the information in the collection object
        # 2) We need statusname which is not in the specific table.
        collection_entry = {
            'name': collection.name,
            'version': collection.version,
            'owner': collection.owner,
            'summary': collection.summary,
            'description': collection.description,
            'statusname': collection.status.locale['C'].statusname
        }

        # Retrieve the package list for this collection
        # pylint:disable-msg=E1101
        packages = select((PackageTable, ),
                          and_(Package.id == PackageListing.packageid,
                               PackageListing.collectionid == collection.id,
                               Package.statuscode != STATUS['Removed']),
                          order_by=(Package.name, )).execute()
        # pylint:enable-msg=E1101

        return dict(title='%s -- %s %s' %
                    (self.app_title, collection.name, collection.version),
                    collection=collection_entry,
                    packages=packages)
コード例 #2
0
ファイル: collections.py プロジェクト: fedora-infra/packagedb
    def name(self, collctn):
        '''Return a page with information on a particular Collection

        :arg collctn: Collection shortname
        '''
        ### FIXME: Want to return additional info:
        # date it was created (join log table: creation date)
        # The initial import doesn't have this information, though.
        try:
            #pylint:disable-msg=E1101
            collection = Collection.by_simple_name(collctn)
        except InvalidRequestError:
            # Either the name doesn't exist or somehow it references more than
            # one value
            flash(_('The collection name you were linked to, %(collctn)s,'
                    ' does not exist.  If you received this error from'
                    ' a link on the fedoraproject.org website, please'
                    ' report it.') % {'collctn': collctn})
            if request_format() == 'json':
                error = dict(exc='InvalidCollection')
            else:
                error = dict(title=_('%(app)s -- Invalid Collection Name') % {
                            'app': self.app_title},
                        tg_template='pkgdb.templates.errors')
            return error

        # Why do we reformat the data returned from the database?
        # 1) We don't need all the information in the collection object
        # 2) We need statusname which is not in the specific table.
        collection_entry = {'name': collection.name,
                'version': collection.version,
                'owner': collection.owner,
                'summary': collection.summary,
                'description': collection.description,
                'statusname': collection.status.locale['C'].statusname
                }

        # Retrieve the package list for this collection
        # pylint:disable-msg=E1101
        packages = select((PackageTable,), and_(Package.id==PackageListing.packageid,
                PackageListing.collectionid==collection.id,
                Package.statuscode!=STATUS['Removed']),
                order_by=(Package.name,)).execute()
        # pylint:enable-msg=E1101

        return dict(title='%s -- %s %s' % (self.app_title, collection.name,
            collection.version), collection=collection_entry,
            packages=packages)
コード例 #3
0
 def by_canonical_name(self, collctn):
     '''
     Retrieve a collection by its canonical_name
     '''
     collection, version = Collection.by_simple_name(collctn)
     return dict(collctn_name=collection, collctn_ver=version)
コード例 #4
0
ファイル: collections.py プロジェクト: fedora-infra/packagedb
 def by_canonical_name(self, collctn):
     '''
     Retrieve a collection by its canonical_name
     '''
     collection, version = Collection.by_simple_name(collctn)
     return dict(collctn_name=collection, collctn_ver=version)