Browse files

Merge branch 'master' of github.com:rtfd/readthedocs.org

  • Loading branch information...
2 parents f5efc32 + b479f53 commit 8c8399dc6035ffd2adc665e0da2a341b28ea3ab0 @ericholscher ericholscher committed Nov 12, 2012
View
6 readthedocs/api/base.py
@@ -52,6 +52,12 @@ def get_object_list(self, request):
def dehydrate(self, bundle):
bundle.data['subdomain'] = "http://%s/" % bundle.obj.subdomain
+ downloads = {}
+ downloads['htmlzip'] = bundle.obj.get_htmlzip_url()
+ downloads['epub'] = bundle.obj.get_epub_url()
+ downloads['pdf'] = bundle.obj.get_pdf_url()
+ downloads['manpage'] = bundle.obj.get_manpage_url()
+ bundle.data['downloads'] = downloads
return bundle
def post_list(self, request, **kwargs):
View
6 readthedocs/core/subdomain_urls.py
@@ -15,6 +15,12 @@
'core.views.serve_docs',
name='docs_detail'
),
+ url(r'^page/(?P<filename>.*)$',
+ 'core.views.serve_docs',
+ {'version_slug': None,
+ 'lang_slug': None},
+ name='docs_detail'
+ ),
url(r'^(?P<lang_slug>\w{2})/(?P<version_slug>.*)/$',
'core.views.serve_docs',
{'filename': 'index.html'},
View
12 readthedocs/projects/models.py
@@ -14,7 +14,7 @@
from projects import constants
from projects.exceptions import ProjectImportError
from projects.templatetags.projects_tags import sort_version_aware
-from projects.utils import highest_version as _highest
+from projects.utils import highest_version as _highest, make_api_version, make_api_project
from taggit.managers import TaggableManager
from tastyapi.slum import api
@@ -449,14 +449,8 @@ def api_versions(self):
from builds.models import Version
ret = []
for version_data in api.version.get(project=self.pk, active=True)['objects']:
- del version_data['resource_uri']
- project_data = version_data['project']
- del project_data['users']
- del project_data['resource_uri']
- del project_data['absolute_url']
- project = Project(**project_data)
- version_data['project'] = project
- ret.append(Version(**version_data))
+ version = make_api_version(version_data)
+ ret.append(version)
return sort_version_aware(ret)
def active_versions(self):
View
1 readthedocs/projects/utils.py
@@ -179,5 +179,6 @@ def make_api_project(project_data):
del project_data['users']
del project_data['resource_uri']
del project_data['absolute_url']
+ del project_data['downloads']
project = Project(**project_data)
return project
View
8 readthedocs/urls.py
@@ -34,14 +34,20 @@
name='docs_detail'
),
- #This is for redirecting /docs/pip/ -> /docs/pip/en/latest/
+ # Redirect to default version.
url(r'^docs/(?P<project_slug>[-\w]+)/$',
'core.views.serve_docs',
{'version_slug': None,
'lang_slug': None,
'filename': ''},
name='docs_detail'
),
+ url(r'^docs/(?P<project_slug>[-\w]+)/page/(?P<filename>.*)$',
+ 'core.views.serve_docs',
+ {'version_slug': None,
+ 'lang_slug': None},
+ name='docs_detail'
+ ),
#WTF are these both here?
#url(r'^docs/', include('projects.urls.public')),

0 comments on commit 8c8399d

Please sign in to comment.