[debexpo-devel] [debexpo/master] Added PackagesController.
Christoph Haas
email at christoph-haas.de
Tue Jun 17 12:33:50 CEST 2008
On Dienstag, 17. Juni 2008, debexpo commit messages wrote:
> + # Loop through all package lists.
> + for package in meta.session.query(Package).all():
> + # Get all package versions.
> + package_versions =
> meta.session.query(PackageVersion).filter_by(package_id=package.id).all(
>)
I just picked that out of today's commit messages. The usual repository
isn't very large. Even mentors.debian.net just has a few hundred packages
online. But I'd suggest you try not to use .all() here. You are fetching
all versions of all packages in the repository. The worst case might be
that Debian itself is using debexpo. I wouldn't want to know how long this
loop would take. :)
Please at least limit the number of results to a reasoanble figure. Or if
you want to deal with the output to a web page I'd suggest you use a
paginator. I have written a module for that purpose that you can find at
http://paginate.workaround.org. If you are bold you can checkout the beta
version of the upcoming Webhelpers 0.6 version where a revised paginate
module is already included. I use it in production here and don't have
much trouble with it. By the times debexpo gets released we'll probably be
on Pylons 0.9.7 and Webhelpers 0.6 anyway. But you can of course use it as
a standalone module either. The paginator is just a module to split up the
results to several pages. And since my module can handle SQLAlchemy
queries the database would get queried with OFFSET and LIMIT to just pull
in the rows that are needed.
And regarding your loop to find out which package version is the newest:
Wouldn't it be okay to assume that newer uploads are always done with a
higher index number than other uploads? That way you could say something
like...
newest_package_version =
session.query(PackageVersion).filter_by(package_id=package.id)[-1]
Cheers
Christoph
P.S.: I already wondered about 2:10. But have you worked through until
6 in the morning? Holy... :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://workaround.org/pipermail/debexpo-devel/attachments/20080617/0ecdca04/attachment.pgp
More information about the debexpo-devel
mailing list