Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error_summary = e.error_summary
return self.group_edit(id, '/' + page, data,
errors, error_summary)
p.toolkit.redirect_to('group_pages', id=id, page='/' + _page['name'])
if not data:
data = _page
errors = errors or {}
error_summary = error_summary or {}
vars = {'data': data, 'errors': errors,
'error_summary': error_summary, 'page': page,
'group_type': 'group'}
return p.toolkit.render('ckanext_pages/group_page_edit.html',
extra_vars=vars)
def show(self, issue_number, dataset_id):
dataset = self._before_dataset(dataset_id)
try:
extra_vars = show.show(issue_number,
dataset_id,
session=model.Session)
except toolkit.ValidationError, e:
p.toolkit.abort(
404, toolkit._('Issue not found: {0}'.format(e.error_summary)))
except toolkit.ObjectNotFound, e:
p.toolkit.abort(
404, toolkit._('Issue not found: {0}'.format(e)))
extra_vars['dataset'] = dataset
return p.toolkit.render('issues/show.html', extra_vars=extra_vars)
def records():
'''Render the records stats page.'''
toolkit.c.datastore_stats = toolkit.get_action(u'dataset_statistics')(
_context(), {})
toolkit.c.num_records = get_record_stats()
return toolkit.render(u'stats/records.html', {
u'title': u'Record statistics'
})
def about_credits(self):
return p.toolkit.render('about/credits.html', {'title': 'Credits'})
c.package_revisions_by_week = rev_stats.get_by_week('package_revisions')
c.new_packages_by_week = rev_stats.get_by_week('new_packages')
c.raw_packages_by_week = []
for week_date, num_packages, cumulative_num_packages in c.num_packages_by_week:
c.raw_packages_by_week.append({'date': h.date_str_to_datetime(week_date), 'total_packages': cumulative_num_packages})
c.raw_all_package_revisions = []
for week_date, revs, num_revisions, cumulative_num_revisions in c.package_revisions_by_week:
c.raw_all_package_revisions.append({'date': h.date_str_to_datetime(week_date), 'total_revisions': num_revisions})
c.raw_new_datasets = []
for week_date, pkgs, num_packages, cumulative_num_packages in c.new_packages_by_week:
c.raw_new_datasets.append({'date': h.date_str_to_datetime(week_date), 'new_packages': num_packages})
return p.toolkit.render('about/statistics.html', {'title': 'Statistics'})
"""
View an individual record
:param id:
:param resource_id:
:param record_id:
:return: html
"""
self._load_data(package_name, resource_id, record_id)
c.dwc = DwC(**c.record_dict)
if c.resource['format'].lower() != 'dwc':
abort(404, _('Record not in Darwin Core format'))
return p.toolkit.render('dwc/view.html')
def qa_openness_stars_dataset_html(dataset):
qa = dataset.get('qa')
if not qa:
return tk.literal('')
if not isinstance(qa, dict):
return tk.literal('')
extra_vars = copy.deepcopy(qa)
return tk.literal(
tk.render('qa/openness_stars_brief.html',
extra_vars=extra_vars))
def search():
'''Render the help page for integrated search.'''
return toolkit.render(u'help/search.html', {
u'title': u'Integrated Search Help'
})
def privacy(self):
'''Render the privacy notice page.'''
return toolkit.render(u'legal/privacy.html', {u'title': u'Privacy notice'})
def view(self, package_name, resource_id, record_id):
"""
View an individual record
:param id:
:param resource_id:
:param record_id:
:return: html
"""
# Try and get the record
c.record_dict = self._get_record(package_name, resource_id, record_id)
return p.toolkit.render('record/view.html')