[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#761149: debsources: allow redirects to package versions based on suite/codename



Hello !

I have spent some time on this; it seems to work well on my local
install of debsources. However I am not sure how to tackle
stable/testing/unstable aliases to wheezy/jessie/sid respectively.

@ Stefano, do you have a suggestion on how I could achieve this?

For example, /src/linux/stable/ should redirect to /src/linux/wheezy/.
But this should not be hardcoded, since stable will need to redirect to
jessie eventually.


I have attached a patch of my work so far

Cheers

-- 
Jason Pleau
diff --git a/debsources/app/views.py b/debsources/app/views.py
index 565b17a..dc17e3c 100644
--- a/debsources/app/views.py
+++ b/debsources/app/views.py
@@ -572,6 +572,15 @@ class SourceView(GeneralView):
             if version == "latest":  # we search the latest available version
                 return self._handle_latest_version(package, path)
             else:
+                try:
+                    versions_w_suites = PackageName.list_versions_w_suites(
+                        session, package)
+                except InvalidPackageOrVersionError:
+                    raise Http404Error("%s not found" % package)
+                for version_suite in versions_w_suites:
+                    if version in version_suite['suites']:
+                        return self._render_location(
+                            package, version_suite['version'], path)
                 return self._render_location(package, version, path)
 
 

Reply to: