Commit Graph

12 Commits

Author SHA1 Message Date
Dan McGee
66850026ca Use content_type and not mimetype on HttpResponse()
Bug #16519 in Django deprecates mimetype, so update our code
accordingly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13 22:34:33 -06:00
Dan McGee
2ee662c77c Extract some common architecture grabbing logic
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-10-26 17:05:39 -05:00
Dan McGee
f5d3c02eb1 Revert "Fall back to 410 Gone for package files view as well"
This reverts commit 9ab460c53a.

This seemed like the right thing to do, but it doesn't really play well
with our more general dispatch framework we now do on the package
details pages. Just let it 404 like it always did, as these pages are
less essential. We can perhaps add a full dispatcher later if we really
feel the need.
2012-07-31 19:49:37 -05:00
Dan McGee
5f85a1240d Reuse removed template for packages with multiple replacements
For example, bitcoin-git in the Arch repos is currently marked replaced
by both bitcoin-qt and bitcoin-daemon. This allows us to show a page
with both options listed instead of a blank 404 page.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:31:44 -05:00
Dan McGee
5f410c000e Add package details redirect for package replacements
This makes sense if there is only one available replacement. We could
get more sophisticated and show the removed page if there are multiple
replacements available.

Additionally, automatically redirect if there was only one matching
package for a given package update deletion object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:12:27 -05:00
Dan McGee
0b7939ae1a Rework package details dispatch code
We had a variety of fallback paths that we took if a details page didn't
exist for the combination of URL parts passed in. Before I go adding a
few more possibilities, rework this so it is more flexible. It is now as
simple as adding a method to the dispatch options list in order to have
further fallback options.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31 19:01:45 -05:00
Dan McGee
76c37ce3ac Replace deprecated direct_to_template() with render() shortcut
Now that Django actually provides a concise way to use a RequestContext
object without instantiating it, we can use that rather than the old
function-based generic view that worked well to do the same.
Additionally, these function-based generic views will be gone in Django
1.5, so might as well make the move now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-24 19:57:20 -05:00
Dan McGee
9ab460c53a Fall back to 410 Gone for package files view as well
This is another thing that Google and other search engines try to crawl
that no longer exists at times, so we should handle it gracefully.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:47:43 -05:00
Dan McGee
211340c8bd Ensure package files JS can support corner cases
We should handle the cases dealing with no filelist available, outdated
filelist, or a package without files, just as the HTML server-side page
does. Add a bit more info to the JSON returned so we can do so.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:31:17 -05:00
Dan McGee
374bf53505 Remove files list AJAX conditionals
Now that we just generate this list in JS, we don't need this separate
code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 21:17:02 -05:00
Dan McGee
946d90d08f Add '410 Gone' support for packages moved out of repositories
This allows us to do better than a generic 404 handler when we know a
package previously existed in a given repository, and should also make
things a bit nicer when getting sent in from a search engine to a page
that no longer exists.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-23 09:55:46 -05:00
Dan McGee
872d4bcaa2 Split details/display package views into new module
This moves a lot of the package and group display logic into a new view
module, similar to what we already did earlier with a bunch of other
views.

Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-21 11:26:34 -05:00