From: Alex Sadleir Date: Tue, 13 May 2014 05:20:46 +0000 Subject: beginnings of autoupdate script X-Git-Url: http://maxious.lambdacomplex.org/git/?p=ckanext-datagovau.git&a=commitdiff&h=b16ddd748d2b409355584fb777ccd9c8859cc6ea --- beginnings of autoupdate script --- --- a/admin/autoupdate.py +++ b/admin/autoupdate.py @@ -5,14 +5,14 @@ import fileinput import csv -def updateresource(id): +def updateresource(resource_id): url = 'http://data.disclosurelo.gs' api_key = '' db_credentials = '' - print id + print resource_id ckan = ckanapi.RemoteCKAN('http://data.disclosurelo.gs') #ckan = ckanapi.RemoteCKAN('http://demo.ckan.org') - resource = ckan.action.resource_show(id=id) + resource = ckan.action.resource_show(id=resource_id) print resource url = resource['url'] #last_modified= 'Mon, 24 Feb 2014 01:48:29 GMT' @@ -34,12 +34,18 @@ if 'etag' in r.headers: resource['etag'] = r.headers['etag'] #save updated resource +# result = ckan.action.resource_update(id,resource) if 'format' == 'shp': - print "geoingest!" + print "geoingest!" db_settings_json, api_url, api_key, resource['dataset_id'] else: ckan.action.datapusher_submit(resource_id=id) -# result = ckan.action.resource_update(id,resource) +if len(sys.argv) != 5: + print "spatial ingester. command line: postgis_url api_url api_key" + sys.exit(errno.EACCES) +else: + (path, db_settings_json, api_url, api_key) = sys.argv + db_settings = json.loads(db_settings_json) for line in fileinput.input(): row = csv.reader(line) --- /dev/null +++ b/admin/start.sh @@ -1,1 +1,6 @@ +export NEW_RELIC_CONFIG_FILE="newrelic.ini" +export VIRTUAL_ENV="/var/lib/ckan/dga/pyenv" +export PATH="/var/lib/ckan/dga/pyenv:/var/lib/ckan/dga/pyenv/bin:$PATH" +cd /var/lib/ckan/dga/pyenv/src/ckan +newrelic-admin run-program paster serve development.ini --- a/ckanext/datagovau/plugin.py +++ b/ckanext/datagovau/plugin.py @@ -22,6 +22,9 @@ filtered_dict[dataset['id']] = dataset return filtered_dict.values() +def related_create(context, data_dict=None): + return {'success': False, 'msg': 'No one is allowed to create related items'} + class DataGovAuPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm): '''An example IDatasetForm CKAN plugin. @@ -31,6 +34,10 @@ ''' plugins.implements(plugins.IConfigurer, inherit=False) plugins.implements(plugins.ITemplateHelpers, inherit=False) + plugins.implements(plugins.IAuthFunctions) + + def get_auth_functions(self): + return {'rekated_create': related_create} def update_config(self, config): # Add this plugin's templates dir to CKAN's extra_template_paths, so --- a/ckanext/datagovau/templates/home/index.html +++ b/ckanext/datagovau/templates/home/index.html @@ -1,24 +1,18 @@ {% ckan_extends %} - {% block home_search %} - -
- -
-
-
- - +
-
-

{{ _("Search Your Data") }}

-
- - -
-
+{{ super() }} {% endblock %} --- /dev/null +++ b/ckanext/datagovau/templates/home/snippets/promoted.html @@ -1,1 +1,17 @@ +{% set intro = g.site_intro_text %} +
+
+ {% if intro %} + {{ h.render_markdown(intro) }} + {% else %} +

{{ _("Welcome to CKAN") }}

+

+ {% trans %}This is a nice introductory paragraph about CKAN or the site + in general. We don't have any copy to go here yet but soon we will + {% endtrans %} +

+ {% endif %} +
+
+ --- a/ckanext/datagovau/templates/home/snippets/search.html +++ /dev/null @@ -1,70 +1,1 @@ -
- - - -
-
-
- - - - - -{% set tags = h.get_facet_items_dict('tags', limit=3) %} -{% set placeholder = _('eg. Gold Prices') %} - - - --- /dev/null +++ b/ckanext/datagovau/templates/home/snippets/stats.html @@ -1,1 +1,78 @@ +{% set stats = h.get_site_statistics() %} + +
+ +
+ +
+
+ + + + + +