Skip to content

Commit

Permalink
Merge pull request #2061 from ckan/2040-remove-packagesaver
Browse files Browse the repository at this point in the history
Removes package saver to close #2040
  • Loading branch information
David Read committed Nov 20, 2014
2 parents 593a42e + a45b373 commit 75cc192
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 155 deletions.
36 changes: 0 additions & 36 deletions ckan/controllers/group.py
Expand Up @@ -884,39 +884,3 @@ def _get_group_dict(self, id):
abort(404, _('Group not found'))
except NotAuthorized:
abort(401, _('Unauthorized to read group %s') % id)

def _render_edit_form(self, fs):
# errors arrive in c.error and fs.errors
c.fieldset = fs
return render('group/edit_form.html')

def _update(self, fs, group_name, group_id):
'''
Writes the POST data (associated with a group edit) to the database
@input c.error
'''
validation = fs.validate()
if not validation:
c.form = self._render_edit_form(fs)
raise base.ValidationException(fs)

try:
fs.sync()
except Exception, inst:
model.Session.rollback()
raise
else:
model.Session.commit()

def _update_authz(self, fs):
validation = fs.validate()
if not validation:
c.form = self._render_edit_form(fs)
raise base.ValidationException(fs)
try:
fs.sync()
except Exception, inst:
model.Session.rollback()
raise
else:
model.Session.commit()
3 changes: 0 additions & 3 deletions ckan/controllers/package.py
Expand Up @@ -14,7 +14,6 @@
import ckan.logic as logic
import ckan.lib.base as base
import ckan.lib.maintain as maintain
import ckan.lib.package_saver as package_saver
import ckan.lib.i18n as i18n
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.lib.accept as accept
Expand Down Expand Up @@ -421,8 +420,6 @@ def read(self, id, format='html'):
self._setup_template_variables(context, {'id': id},
package_type=package_type)

package_saver.PackageSaver().render_package(c.pkg_dict, context)

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

Expand Down
116 changes: 0 additions & 116 deletions ckan/lib/package_saver.py

This file was deleted.

8 changes: 8 additions & 0 deletions ckan/lib/plugins.py
Expand Up @@ -221,6 +221,8 @@ def show_package_schema(self):
return ckan.logic.schema.default_show_package_schema()

def setup_template_variables(self, context, data_dict):
from ckan.lib.helpers import render_markdown

authz_fn = logic.get_action('group_list_authz')
c.groups_authz = authz_fn(context, data_dict)
data_dict.update({'available_only': True})
Expand All @@ -235,6 +237,12 @@ def setup_template_variables(self, context, data_dict):

if c.pkg:
c.related_count = c.pkg.related_count
c.pkg_notes_formatted = render_markdown(c.pkg.notes)

if context.get('revision_id') or context.get('revision_date'):
c.pkg_revision_id = c.pkg_dict[u'revision_id']
c.pkg_revision_timestamp = c.pkg_dict[u'revision_timestamp']
c.pkg_revision_not_latest = c.pkg_dict[u'revision_id'] != c.pkg.revision.id

## This is messy as auths take domain object not data_dict
context_pkg = context.get('package', None)
Expand Down

0 comments on commit 75cc192

Please sign in to comment.