Commit ef7db155 authored by Ross Jones's avatar Ross Jones
Browse files

Only obtain a list of publishers if we are creating or editing

CKAN 2 appears to call setup_template_variables in read() as well as new() and edit() and as a result it is slow for logged in users. This only gets the publisher list for edit/new calls.
parent 77223c69
......@@ -127,9 +127,12 @@ class DatasetForm(SingletonPlugin):
c.update_frequency = filter(lambda f: f[0] != 'discontinued', update_frequency)
c.temporal_granularity = temporal_granularity
c.publishers = self.get_publishers()
c.publishers_json = json.dumps(c.publishers)
# We only actually need these in edit/new and not in read. A fair
# slow down for read but can't see how we can find out where we are
# being called from
if 'save' in context:
c.publishers = self.get_publishers()
c.publishers_json = json.dumps(c.publishers)
c.resource_columns = ('description', 'url', 'format')
## This is messy as auths take domain object not data_dict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment