Repository: readthedocs/readthedocs.org

Issue:
Old version banner uses a version number format present nowhere else
## Details
- Project URL: https://github.com/dfhack/dfhack/
- Build URL: http://dfhack.readthedocs.io/en/v0.40.24-r5/ and http://dfhack.readthedocs.io/en/0.42.06-r1/
- Read the Docs username:  lethosor
## Expected result

The banner on documentation pages for old versions of our project should refer to the newest version using the same version number format present used elsewhere - in this case, "0.43.03-r1"
## Actual result

The banner refers to "0.43.3-post1", which isn't used anywhere else, as far as I can tell.
## Additional Information

It would be great if this banner could use the version numbers that our project uses instead of the ones with "post1" at the end. I realize the scheme we use is a bit unconventional, but it's tied to another project which uses the "0.43.03" format that we don't really have control over.

I made a tentative patch at https://github.com/lethosor/readthedocs.org/commit/7d84130471885905a3f663324af602b7be1f7f64, although I haven't tested it enough to be confident that it'll work for other projects. In particular, I'm not sure in what situations (if any) `slugs` could contain multiple items.



Discussion:
I think this is not a bug in RTD, but how the `packaging` module works: https://pypi.python.org/pypi/packaging

```
>>> from packaging.version import Version
>>> v = '0.43.03-r1'
>>> Version(v)
<Version('0.43.3.post1')>
>>> 
```

This is explained at https://www.python.org/dev/peps/pep-0440/#post-release-spelling

Sorry for not responding earlier - I just got a notification for this about 10 minutes ago.

Anyway, I think you're correct about where that version number is coming from, but it's inconsistent with how everything else (that I can see) is displayed. For instance, on http://dfhack.readthedocs.io/en/stable/, clicking on the version selector in the lower right corner ("v: stable") gives a list of choices such as "0.43.03-r1", "0.43.05-r1", etc., which link to pages with those version numbers in the URLs as well (e.g. http://dfhack.readthedocs.io/en/0.43.05-r1/).
Yeah, I understand your point. So, I think RTD should decide one way or another but not both.

Resolving patch:
diff --git a/readthedocs/restapi/views/footer_views.py b/readthedocs/restapi/views/footer_views.py
--- a/readthedocs/restapi/views/footer_views.py
+++ b/readthedocs/restapi/views/footer_views.py
@@ -43,7 +43,7 @@ def get_version_compare_data(project, base_version=None):
     }
     if highest_version_obj:
         ret_val['url'] = highest_version_obj.get_absolute_url()
-        ret_val['slug'] = (highest_version_obj.slug,)
+        ret_val['slug'] = highest_version_obj.slug
     if base_version and base_version.slug != LATEST:
         try:
             base_version_comparable = parse_version_failsafe(


Test patch:
diff --git a/readthedocs/rtd_tests/tests/test_footer.py b/readthedocs/rtd_tests/tests/test_footer.py
--- a/readthedocs/rtd_tests/tests/test_footer.py
+++ b/readthedocs/rtd_tests/tests/test_footer.py
@@ -104,7 +104,7 @@ def test_highest_version_from_stable(self):
         valid_data = {
             'project': 'Version 0.8.1 of Pip (19)',
             'url': '/dashboard/pip/version/0.8.1/',
-            'slug': ('0.8.1',),
+            'slug': '0.8.1',
             'version': '0.8.1',
             'is_highest': True,
         }
@@ -116,7 +116,7 @@ def test_highest_version_from_lower(self):
         valid_data = {
             'project': 'Version 0.8.1 of Pip (19)',
             'url': '/dashboard/pip/version/0.8.1/',
-            'slug': ('0.8.1',),
+            'slug': '0.8.1',
             'version': '0.8.1',
             'is_highest': False,
         }
@@ -129,7 +129,7 @@ def test_highest_version_from_latest(self):
         valid_data = {
             'project': 'Version 0.8.1 of Pip (19)',
             'url': '/dashboard/pip/version/0.8.1/',
-            'slug': ('0.8.1',),
+            'slug': '0.8.1',
             'version': '0.8.1',
             'is_highest': True,
         }
@@ -157,7 +157,7 @@ def test_highest_version_over_branches(self):
         valid_data = {
             'project': 'Version 1.0.0 of Pip ({})'.format(version.pk),
             'url': '/dashboard/pip/version/1.0.0/',
-            'slug': ('1.0.0',),
+            'slug': '1.0.0',
             'version': '1.0.0',
             'is_highest': False,
         }
@@ -171,7 +171,7 @@ def test_highest_version_without_tags(self):
         valid_data = {
             'project': 'Version 0.8.1 of Pip (19)',
             'url': '/dashboard/pip/version/0.8.1/',
-            'slug': ('0.8.1',),
+            'slug': '0.8.1',
             'version': '0.8.1',
             'is_highest': True,
         }
@@ -182,7 +182,7 @@ def test_highest_version_without_tags(self):
         valid_data = {
             'project': 'Version 0.8.1 of Pip (19)',
             'url': '/dashboard/pip/version/0.8.1/',
-            'slug': ('0.8.1',),
+            'slug': '0.8.1',
             'version': '0.8.1',
             'is_highest': False,
         }
@@ -199,7 +199,7 @@ def test_highest_version_without_tags(self):
         valid_data = {
             'project': 'Version 2.0.0 of Pip ({})'.format(version.pk),
             'url': '/dashboard/pip/version/2.0.0/',
-            'slug': ('2.0.0',),
+            'slug': '2.0.0',
             'version': '2.0.0',
             'is_highest': False,
         }