[ckan-changes] commit/ckanextiati: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Wed Nov 2 17:32:33 UTC 2011
3 new commits in ckanextiati:
https://bitbucket.org/okfn/ckanextiati/changeset/aacf0b290b7f/
changeset: aacf0b290b7f
branch: spreadsheet-support
user: amercader
date: 2011-11-02 18:18:26
summary: Update upload page layout
affected #: 3 files
diff -r 8a6bb9a2a337b3515786cca5cce445d24d1e87e2 -r aacf0b290b7f137cefa95ff817191b1c74e811ce ckanext/iati/public/css/overrides.css
--- a/ckanext/iati/public/css/overrides.css
+++ b/ckanext/iati/public/css/overrides.css
@@ -579,10 +579,13 @@
/*-------- Flash messages --------*/
/*-------- Wordpress Specific --------*/
-
+/*
.type-page
-
-
ul {
list-style-type: none
}
+*/
+.type-page ul {
+ list-style-type: circle
+}
+
diff -r 8a6bb9a2a337b3515786cca5cce445d24d1e87e2 -r aacf0b290b7f137cefa95ff817191b1c74e811ce ckanext/iati/templates/csv/result.html
--- a/ckanext/iati/templates/csv/result.html
+++ b/ckanext/iati/templates/csv/result.html
@@ -7,7 +7,7 @@
<h2 class="head">CSV Import Results</h2>
- <div>CSV file <strong>${c.file_name}</strong> imported.</div>
+ <div>CSV file <strong>${c.file_name}</strong> imported. (<a href="/csv/upload">Upload another file</a>)</div><hr class="cleared" /><h3>Summary</h3><ul>
diff -r 8a6bb9a2a337b3515786cca5cce445d24d1e87e2 -r aacf0b290b7f137cefa95ff817191b1c74e811ce ckanext/iati/templates/csv/upload.html
--- a/ckanext/iati/templates/csv/upload.html
+++ b/ckanext/iati/templates/csv/upload.html
@@ -6,21 +6,37 @@
<div py:match="content"><h2 class="head">CSV Import</h2>
+ <div>
+ <ul>
+ <li>IATI requires that you create a registry record for each file of IATI-xml data that you publish.</li>
+ <li>You may use this import utility to register or update the metadata of these records</li>
+ <li>Please provide a spreadsheet in CSV format containing IATI registry records metadata</li>
+ <li>Your file must follow the format specified in this <a href="/csv/download/template">Template</a>.</li>
+ <li>Guidance on the contents of this file can be found <a href="http://iatiregistry.org/help_csv-import">here</a>.</li>
+ </ul>
+ </div>
+ <hr class="cleared" />
+ <fieldset>
+ <legend>Upload file</legend>
- <div>Please provide a CSV file containing IATI regitry records metadata.</div>
- <div>Files must follow the format specified in this <a href="/csv/download/template">Template</a>.</div>
- <hr class="cleared" />
- <form id="csv-upload" action="/csv/upload" method="POST" enctype="multipart/form-data">
- <dl>
- <dt><label for="file">CSV file</label></dt>
- <dd><input type="file" id="file" name="file"/></dd>
- </dl>
- <div class="submit">
- <input id="upload" name="upload" type="submit" value="Upload" />
- </div>
+ <form id="csv-upload" action="/csv/upload" method="POST" enctype="multipart/form-data">
+ <dl>
+ <dt><label for="file">CSV file</label></dt>
+ <dd><input type="file" id="file" name="file"/></dd>
+ </dl>
+ <div class="submit">
+ <input id="upload" name="upload" type="submit" value="Upload" />
+ </div>
- </form>
-
+ </form>
+ </fieldset>
+ <h3>Warning:</h3>
+ <ul>
+ <li>For publishers with a large number of datasets it may take a while to upload the CSV file. Please be patient.</li>
+ <li>You may only upload records that contain your authorised registry-publisher-idi.</li>
+ <li>This import will overwrite all fields in each record specified in the file. Blank cells in the file will overwrite existing data.</li>
+ <li>This import will not delete records in the registry. To delete a record follow the instructions <a href="http://iatiregistry.org/help_delete">here</a>.</li>
+ </ul></div><xi:include href="../layout.html" />
https://bitbucket.org/okfn/ckanextiati/changeset/6632751c3d2c/
changeset: 6632751c3d2c
branch: spreadsheet-support
user: amercader
date: 2011-11-02 18:31:32
summary: Catch exceptions while sniffing and reading the CSV file
affected #: 1 file
diff -r aacf0b290b7f137cefa95ff817191b1c74e811ce -r 6632751c3d2cee631e8028d0215e848063d4b968 ckanext/iati/controllers/spreadsheet.py
--- a/ckanext/iati/controllers/spreadsheet.py
+++ b/ckanext/iati/controllers/spreadsheet.py
@@ -111,7 +111,7 @@
csv_file = request.POST['file']
if not hasattr(csv_file,'filename'):
- abort(403,'No file provided')
+ abort(400,'No CSV file provided')
c.file_name = csv_file.filename
@@ -183,10 +183,15 @@
def read_csv_file(self,csv_file):
fieldnames = [f[0] for f in CSV_MAPPING]
- # Try to sniff the file dialect
- dialect = csv.Sniffer().sniff(csv_file.file.read(1024))
- csv_file.file.seek(0)
- reader = csv.DictReader(csv_file.file, dialect=dialect)
+ try:
+ # Try to sniff the file dialect
+ dialect = csv.Sniffer().sniff(csv_file.file.read(1024))
+ csv_file.file.seek(0)
+
+ reader = csv.DictReader(csv_file.file, dialect=dialect)
+ except csv.Error,e:
+ abort(400,'Error reading CSV file: %s' % str(e))
+
log.debug('Starting reading file %s (delimiter "%s", escapechar "%s")' %
(csv_file.filename,dialect.delimiter,dialect.escapechar))
https://bitbucket.org/okfn/ckanextiati/changeset/3dce19ee7b75/
changeset: 3dce19ee7b75
branch: resource-archiver
user: amercader
date: 2011-11-02 18:32:13
summary: [merge] from spreadsheet-support
affected #: 4 files
diff -r 9b9f1ad1ba54734bf4ba726f201c7f49b6ddb005 -r 3dce19ee7b75f8a3ad94da5b23fa472fbdbb95e0 ckanext/iati/controllers/spreadsheet.py
--- a/ckanext/iati/controllers/spreadsheet.py
+++ b/ckanext/iati/controllers/spreadsheet.py
@@ -111,7 +111,7 @@
csv_file = request.POST['file']
if not hasattr(csv_file,'filename'):
- abort(403,'No file provided')
+ abort(400,'No CSV file provided')
c.file_name = csv_file.filename
@@ -183,10 +183,15 @@
def read_csv_file(self,csv_file):
fieldnames = [f[0] for f in CSV_MAPPING]
- # Try to sniff the file dialect
- dialect = csv.Sniffer().sniff(csv_file.file.read(1024))
- csv_file.file.seek(0)
- reader = csv.DictReader(csv_file.file, dialect=dialect)
+ try:
+ # Try to sniff the file dialect
+ dialect = csv.Sniffer().sniff(csv_file.file.read(1024))
+ csv_file.file.seek(0)
+
+ reader = csv.DictReader(csv_file.file, dialect=dialect)
+ except csv.Error,e:
+ abort(400,'Error reading CSV file: %s' % str(e))
+
log.debug('Starting reading file %s (delimiter "%s", escapechar "%s")' %
(csv_file.filename,dialect.delimiter,dialect.escapechar))
diff -r 9b9f1ad1ba54734bf4ba726f201c7f49b6ddb005 -r 3dce19ee7b75f8a3ad94da5b23fa472fbdbb95e0 ckanext/iati/public/css/overrides.css
--- a/ckanext/iati/public/css/overrides.css
+++ b/ckanext/iati/public/css/overrides.css
@@ -579,10 +579,13 @@
/*-------- Flash messages --------*/
/*-------- Wordpress Specific --------*/
-
+/*
.type-page
-
-
ul {
list-style-type: none
}
+*/
+.type-page ul {
+ list-style-type: circle
+}
+
diff -r 9b9f1ad1ba54734bf4ba726f201c7f49b6ddb005 -r 3dce19ee7b75f8a3ad94da5b23fa472fbdbb95e0 ckanext/iati/templates/csv/result.html
--- a/ckanext/iati/templates/csv/result.html
+++ b/ckanext/iati/templates/csv/result.html
@@ -7,7 +7,7 @@
<h2 class="head">CSV Import Results</h2>
- <div>CSV file <strong>${c.file_name}</strong> imported.</div>
+ <div>CSV file <strong>${c.file_name}</strong> imported. (<a href="/csv/upload">Upload another file</a>)</div><hr class="cleared" /><h3>Summary</h3><ul>
diff -r 9b9f1ad1ba54734bf4ba726f201c7f49b6ddb005 -r 3dce19ee7b75f8a3ad94da5b23fa472fbdbb95e0 ckanext/iati/templates/csv/upload.html
--- a/ckanext/iati/templates/csv/upload.html
+++ b/ckanext/iati/templates/csv/upload.html
@@ -6,21 +6,37 @@
<div py:match="content"><h2 class="head">CSV Import</h2>
+ <div>
+ <ul>
+ <li>IATI requires that you create a registry record for each file of IATI-xml data that you publish.</li>
+ <li>You may use this import utility to register or update the metadata of these records</li>
+ <li>Please provide a spreadsheet in CSV format containing IATI registry records metadata</li>
+ <li>Your file must follow the format specified in this <a href="/csv/download/template">Template</a>.</li>
+ <li>Guidance on the contents of this file can be found <a href="http://iatiregistry.org/help_csv-import">here</a>.</li>
+ </ul>
+ </div>
+ <hr class="cleared" />
+ <fieldset>
+ <legend>Upload file</legend>
- <div>Please provide a CSV file containing IATI regitry records metadata.</div>
- <div>Files must follow the format specified in this <a href="/csv/download/template">Template</a>.</div>
- <hr class="cleared" />
- <form id="csv-upload" action="/csv/upload" method="POST" enctype="multipart/form-data">
- <dl>
- <dt><label for="file">CSV file</label></dt>
- <dd><input type="file" id="file" name="file"/></dd>
- </dl>
- <div class="submit">
- <input id="upload" name="upload" type="submit" value="Upload" />
- </div>
+ <form id="csv-upload" action="/csv/upload" method="POST" enctype="multipart/form-data">
+ <dl>
+ <dt><label for="file">CSV file</label></dt>
+ <dd><input type="file" id="file" name="file"/></dd>
+ </dl>
+ <div class="submit">
+ <input id="upload" name="upload" type="submit" value="Upload" />
+ </div>
- </form>
-
+ </form>
+ </fieldset>
+ <h3>Warning:</h3>
+ <ul>
+ <li>For publishers with a large number of datasets it may take a while to upload the CSV file. Please be patient.</li>
+ <li>You may only upload records that contain your authorised registry-publisher-idi.</li>
+ <li>This import will overwrite all fields in each record specified in the file. Blank cells in the file will overwrite existing data.</li>
+ <li>This import will not delete records in the registry. To delete a record follow the instructions <a href="http://iatiregistry.org/help_delete">here</a>.</li>
+ </ul></div><xi:include href="../layout.html" />
Repository URL: https://bitbucket.org/okfn/ckanextiati/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list