Skip to content

Commit

Permalink
Merge branch '2741-remove-rdf-cruft'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Nov 24, 2015
2 parents 3318779 + e03e7da commit 4dbfa46
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 146 deletions.
1 change: 0 additions & 1 deletion ckan/config/routing.py
Expand Up @@ -234,7 +234,6 @@ def make_map():
m.connect('/dataset/activity/{id}/{offset}', action='activity')
m.connect('dataset_groups', '/dataset/groups/{id}',
action='groups', ckan_icon='group')
m.connect('/dataset/{id}.{format}', action='read')
m.connect('dataset_resources', '/dataset/resources/{id}',
action='resources', ckan_icon='reorder')
m.connect('dataset_read', '/dataset/{id}', action='read',
Expand Down
34 changes: 1 addition & 33 deletions ckan/controllers/package.py
Expand Up @@ -13,7 +13,6 @@
import ckan.lib.maintain as maintain
import ckan.lib.i18n as i18n
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.lib.accept as accept
import ckan.lib.helpers as h
import ckan.model as model
import ckan.lib.datapreview as datapreview
Expand Down Expand Up @@ -306,22 +305,6 @@ def pager_url(q=None, page=None):
return render(self._search_template(package_type),
extra_vars={'dataset_type': package_type})

def _content_type_from_extension(self, ext):
ct, ext = accept.parse_extension(ext)
if not ct:
return None, None
return ct, ext

def _content_type_from_accept(self):
"""
Given a requested format this method determines the content-type
to set and the genshi template loader to use in order to render
it accurately. TextTemplate must be used for non-xml templates
whilst all that are some sort of XML should use MarkupTemplate.
"""
ct, ext = accept.parse_header(request.headers.get('Accept', ''))
return ct, ext

def resources(self, id):
context = {'model': model, 'session': model.Session,
'user': c.user or c.author, 'for_view': True,
Expand Down Expand Up @@ -350,20 +333,7 @@ def resources(self, id):
return render('package/resources.html',
extra_vars={'dataset_type': package_type})

def read(self, id, format='html'):
if not format == 'html':
ctype, extension = \
self._content_type_from_extension(format)
if not ctype:
# An unknown format, we'll carry on in case it is a
# revision specifier and re-constitute the original id
id = "%s.%s" % (id, format)
ctype, format = "text/html; charset=utf-8", "html"
else:
ctype, format = self._content_type_from_accept()

response.headers['Content-Type'] = ctype

def read(self, id):
context = {'model': model, 'session': model.Session,
'user': c.user or c.author, 'for_view': True,
'auth_user_obj': c.userobj}
Expand Down Expand Up @@ -415,8 +385,6 @@ def read(self, id, format='html'):
package_type=package_type)

template = self._read_template(package_type)
template = template[:template.index('.') + 1] + format

try:
return render(template,
extra_vars={'dataset_type': package_type})
Expand Down
62 changes: 0 additions & 62 deletions ckan/lib/accept.py

This file was deleted.

50 changes: 0 additions & 50 deletions ckan/tests/legacy/lib/test_accept.py

This file was deleted.

0 comments on commit 4dbfa46

Please sign in to comment.