summaryrefslogtreecommitdiff
path: root/packages
AgeCommit message (Collapse)Author
2013-04-23When retrieving signoff specs, select the arch object as wellrelease_2013-04-27Dan McGee
Otherwise we do one query per row in the signoff table to fetch the architecture and it's required_signoffs value, which is less than ideal. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-22Use required_signoffs value when creating signoff specsDan McGee
And respect it elsewhere when we create a fake default specification because a real one does not exist yet. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-20Fix parsing issues when query string keys contain unicodeDan McGee
This is dirty, but it works. There is probably a better and cleaner way to do all of this, but for now just fix it quickly. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16Various minor code cleanups and fixesrelease_2013-04-16Dan McGee
Most of these were suggested by PyCharm, and include everything from little syntax issues and other bad smells to dead or bad code. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16Add shortcut for HEAD requests on slower viewsDan McGee
We sometimes see some web bots and crawlers make HEAD requests to verify existence of certain pages in the application. However, they are less than kind as 20-50 requests might arrive at the same time, and package search and details pages are some of the slowest rendering pages we have due to the Django template engine. Rather than waste time generating the content only to throw it away, response as soon as we can with either a 404 or 200 response as appropriate, omitting the 'Content-Length' header completely, which seems to be acceptable by the HTTP spec. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16Use require_safe decorator rather than require_GETDan McGee
This was added in Django 1.4, and ensures both GET and HEAD requests, but not POST requests, are allowed through. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-14Fix missing attribute error in replacment find codeDan McGee
Whoops. Just introduced this when ensuring we look for both the packgae in other repositories as well as any replacments. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13Show replacments for package if it has been removedDan McGee
This covers the case where we can't find the package in any other repositories, but it was removed recently enough that we have a found package update object. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13Add additional pg_trgm indexes for quicker searchesDan McGee
This allows our normal keyword-based search to be index-optimized rather than always doing full table scans. It requires the pg_trgm extension which is shipped out of the box with any sane install of PostgreSQL. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11Remove function caching in packages/utilsDan McGee
We don't see these called enough to make caching the data worth it. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-26Use user.userprofile rather than user.get_profile()Dan McGee
The get_profile() function is deprecated as of Django 1.5. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-26Fix ALPM unittest to run when ALPM isn't presentDan McGee
This gets some proper unittest skip decorator action now in addition to adding more testing around everything. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-26Merge branch 'django-1.5'Dan McGee
Conflicts: requirements.txt requirements_prod.txt
2013-02-20Fix some fallout with moving page to query paramsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-16Make page a query string parameter on package searchDan McGee
This is a bit silly to encode in the URL, or at least makes it much harder to screen out via robots.txt and other such things. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-16Remove configurable pagination for package searchDan McGee
Switch it to a hardcoded value of 100 for all searches instead. It didn't make much sense having a page number be part of the URL and a limit value being part of the query string. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-10Fix split packages sitemaprelease_2013-02-16Dan McGee
We had a ton of duplicate entries included due to the query implicitly including a 'GROUP BY' clause on the default sorting by pkgname. Fix it and cut the sitemap down to the correct size without duplicate entries. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-09Use 'update_fields' model.save() kwargDan McGee
This was added in Django 1.5 and allows saving only a subset of a model's fields. It makes sense in a few cases to utilize it. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-09Revert "Reduce query count when retrieving satisfiers and providers"Dan McGee
This reverts commit 20b64e42672d185821cc584dfa4b133ee259a144. Django 1.5 fixed this issue and now parent objects are automatically attached to their children when queries go through the related manager. See "Caching of related model instances" in the release notes. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-08Remove package seach by 'Last Updated After'Dan McGee
It is a lot easier to just sort the list rather than mess with this particular field, which didn't even allow you to specify a range or direction to search in. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-23Use more modern verison of string template formattingDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-23Use querysets for calls to get_object_or_404(Package)Dan McGee
This works better in most cases since we need the architecture and repository objects at some point during the view process. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-22Slight optimization when searching for removed packageDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-22Override the default admin queryset for some modelsDan McGee
Because some attributes are optional or otherwise not auto-magically picked up by Django, we can help the performance of loading these pages a lot by forcing a select_related() on the queryset used by the admin. For something like signoff_specifications, this drops the query count from ~107 to 9 queries. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-22Use a subquery rather than two queries in attach_maintainersDan McGee
Now that we are using a database that doesn't stink, it makes more sense to do all of the stuff we need to do down at the database level. This helps a lot when 500+ packages are in play at a given time, such as some of our larger rebuild todo lists. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-18Use a set instead of list when gathering package differencesDan McGee
If we implement the __eq__ and __hash__ methods, we can use a set to gather package difference objects and make deduplication of objects a lot more efficient. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13Use content_type and not mimetype on HttpResponse()Dan McGee
Bug #16519 in Django deprecates mimetype, so update our code accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-12Make packages JSON search more performantrelease_2013-01-12Dan McGee
We were peppering the database with a bunch of queries here; using prefetch_related and attach_maintainers can cut down the count significantly. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-12Add get_associated_packages method to FlagRequestDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Reduce query count when retrieving satisfiers and providersDan McGee
Django doesn't attach the parent object to the child objects, even when queried through the related manager. This causes up to 3 extra queries: one to retrieve the package again, and one each for arch and repo retrieval. For a package like archboot, this drops the number of necessary queries for the package page from 805 to 222 (yes, this is still too high) and cuts the time spent waiting on the database from 505ms to 262ms. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Allow pkg_details_link to return link title if package is missingDan McGee
For todolist packages that have had their package removed, this will allow the package name to continue to appear even after the linked package has been deleted. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-28Make attach_maintainers null-safeDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-27Add some more tests for ALPM API stuffDan McGee
These are super-simple, but it is also trivial to test. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-11Fix FS#32018, provides links always go to [testing] packagesDan McGee
Remove some of the smarts and do less, but be better about properly sorting the items as one might expect. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use python set comprehension syntax supported in 2.7Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use Python 2.7 dictionary comprehension syntaxDan McGee
Rather than the old idiom of dict((k, v) for <> in <>). Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-26Cleanup meta model attributesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-26Extract some common architecture grabbing logicDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-14Refactor signoff-grabbing queriesDan McGee
Make them a bit more efficient by adding an explicit condition on both the packages and signoff table for the repo ID, and move the common code into a shared function both can use. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-12Make wrong permissions query more efficientDan McGee
This removes the subplan and per-row query in favor of a LEFT JOIN where we look for non-matching rows. Tested in sqlite3 and PostgreSQL. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-30pkg_details_link template tag enhancementsDan McGee
* Output the blank string when passed None for pkg argument * Allow override of the link text if optional argument passed Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-30Fix usage of naïve datetime objectDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-30Hide staging packages in search resultsDan McGee
This is for users that aren't logged in; developers will still see them. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-25Don't show staging in package search repo listingDan McGee
This is temporary or at least a quick way to ensure regular users aren't confused by staging packages; later updates should re-enable display of this for logged in developers and trusted users. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-15Remove now unnecessary importrelease_2012-09-15Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-08p/v/flag: Add reply-to to out-of-date notificationsFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-21Fix scm_link in a way that doesn't make cgit barfDan McGee
This does what commit cd51842ce86 set out to do in a way that doesn't break cgit's not-so-hit query string parsing. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-21Style cleanups in package_extrasDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-08-21Revert "Fix scm_link for Unicode characters"Dan McGee
This reverts commit cd51842ce86c44eef4e3c3d5334aca13e234151a. It turns out cgit doesn't like it if you escape the '/' in the URL parameter when viewing the log (a clear upstream bug), but we need to be able to work around this. Example: 'extra%2Fkdelibs' and 'extra/kdelibs' are handled differently.
2012-08-20Fix scm_link for Unicode charactersDan McGee
This blew up with non-ASCII due to us trying to stuff 8-bit characters into the URL parameters where they aren't allowed. Tested with a package entered via the admin with pkgname and pkgbase set to 'αναζήτη'. Signed-off-by: Dan McGee <dan@archlinux.org>