[ckan-changes] [okfn/ckan] 11c754: Fix some broken URLs in the storage controller
GitHub
noreply at github.com
Fri Apr 13 20:07:18 UTC 2012
Branch: refs/heads/bug-2264-audit-of-string-i18n
Home: https://github.com/okfn/ckan
Commit: 11c754debc1aba82f4db34a269831463af31cf83
https://github.com/okfn/ckan/commit/11c754debc1aba82f4db34a269831463af31cf83
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2012-04-13 (Fri, 13 Apr 2012)
Changed paths:
M ckan/controllers/storage.py
M ckan/tests/functional/test_storage.py
Log Message:
-----------
Fix some broken URLs in the storage controller
It was forming the wrong URLs when the user has a language other than
the default one selected, e.g /destorage instead of /de/storage.
diff --git a/ckan/controllers/storage.py b/ckan/controllers/storage.py
index 34af131..594d915 100644
--- a/ckan/controllers/storage.py
+++ b/ckan/controllers/storage.py
@@ -115,7 +115,7 @@ def ofs(self):
def upload(self):
label = key_prefix + request.params.get('filepath', str(uuid.uuid4()))
c.data = {
- 'action': h.url_for('storage_upload_handle'),
+ 'action': h.url_for('storage_upload_handle', qualified=False),
'fields': [
{
'name': 'key',
@@ -266,7 +266,7 @@ def get_metadata(self, label):
else:
url = h.url_for('storage_file',
label=label,
- qualified=True
+ qualified=False
)
if not self.ofs.exists(bucket, label):
abort(404)
@@ -372,7 +372,7 @@ def _get_form_data(self, label):
return self._get_remote_form_data(label)
else:
data = {
- 'action': h.url_for('storage_upload_handle', qualified=True),
+ 'action': h.url_for('storage_upload_handle', qualified=False),
'fields': [
{
'name': 'key',
diff --git a/ckan/tests/functional/test_storage.py b/ckan/tests/functional/test_storage.py
index 27182b5..ca072e1 100644
--- a/ckan/tests/functional/test_storage.py
+++ b/ckan/tests/functional/test_storage.py
@@ -63,7 +63,7 @@ def teardown_class(cls):
def test_auth_form(self):
url = url_for('storage_api_auth_form', label='abc')
res = self.app.get(url, extra_environ=self.extra_environ, status=200)
- assert res.json['action'] == u'http://localhost/storage/upload_handle', res.json
+ assert res.json['action'] == u'/storage/upload_handle', res.json
assert res.json['fields'][-1]['value'] == 'abc', res
url = url_for('storage_api_auth_form', label='abc/xxx')
================================================================
Commit: a290c4a74563ec6f535586b3fab58afad17b1f59
https://github.com/okfn/ckan/commit/a290c4a74563ec6f535586b3fab58afad17b1f59
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2012-04-13 (Fri, 13 Apr 2012)
Changed paths:
M ckan/public/scripts/templates.js
M ckan/templates/js_strings.html
Log Message:
-----------
[i18n] Mark a string for translation on the resource upload form
diff --git a/ckan/public/scripts/templates.js b/ckan/public/scripts/templates.js
index e60c2d3..66b06cb 100644
--- a/ckan/public/scripts/templates.js
+++ b/ckan/public/scripts/templates.js
@@ -81,7 +81,7 @@ CKAN.Templates.resourceDetails = ' \
<label for="" class="control-label" property="rdfs:label">'+CKAN.Strings.resourceType+'</label> \
<div class="controls"> \
{{if resource.resource_type=="file.upload"}} \
- Data File (Uploaded) \
+ '+CKAN.Strings.dataFileUploaded+' \
<input name="resources__${num}__resource_type" type="hidden" value="${resource.resource_type}" /> \
{{/if}} \
{{if resource.resource_type!="file.upload"}} \
diff --git a/ckan/templates/js_strings.html b/ckan/templates/js_strings.html
index 204b33b..5ba337c 100644
--- a/ckan/templates/js_strings.html
+++ b/ckan/templates/js_strings.html
@@ -67,5 +67,6 @@
CKAN.Strings.youCanUseMarkdown = "${_('You can use %aMarkdown formatting%b here.')}";
CKAN.Strings.shouldADataStoreBeEnabled = "${_('Should a %aDataStore table and Data API%b be enabled for this resource?')}";
CKAN.Strings.datesAreInISO = "${_('Dates are in %aISO Format%b — eg. %c2012-12-25%d or %c2010-05-31T14:30%d.')}";
+ CKAN.Strings.dataFileUploaded = "${_('Data File (Uploaded)')}";
</script>
================================================================
Commit: 76cb37a938e475f57183e290542515b3df604b3a
https://github.com/okfn/ckan/commit/76cb37a938e475f57183e290542515b3df604b3a
Author: Sean Hammond <seanhammond at lavabit.com>
Date: 2012-04-13 (Fri, 13 Apr 2012)
Changed paths:
M ckan/lib/helpers.py
M ckan/templates/package/history.html
Log Message:
-----------
[i18n] Mark a tooltip for translation on the dataset history page
diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py
index cf5373b..e624027 100644
--- a/ckan/lib/helpers.py
+++ b/ckan/lib/helpers.py
@@ -460,10 +460,10 @@ def format_icon(_format):
return 'page_white'
def linked_gravatar(email_hash, size=100, default=None):
- return literal('''<a href="https://gravatar.com/" target="_blank"
- title="Update your avatar at gravatar.com">
- %s</a>''' %
- gravatar(email_hash,size,default)
+ return literal(
+ '<a href="https://gravatar.com/" target="_blank"' +
+ 'title="%s">' % _('Update your avatar at gravatar.com') +
+ '%s</a>' % gravatar(email_hash,size,default)
)
_VALID_GRAVATAR_DEFAULTS = ['404', 'mm', 'identicon', 'monsterid', 'wavatar', 'retro']
diff --git a/ckan/templates/package/history.html b/ckan/templates/package/history.html
index 1ac3a30..b9d034b 100644
--- a/ckan/templates/package/history.html
+++ b/ckan/templates/package/history.html
@@ -34,7 +34,7 @@ <h3 py:if="c.error" class="form-errors">
<a href="${h.url_for(controller='revision',action='read',id=rev['id'])}">${rev['id'][:4]}…</a>
</td>
<td>
- <a href="${h.url_for(controller='package',action='read',id='%s@%s' % (c.pkg_dict['name'], rev['timestamp']))}" title="${'Read dataset as of %s' % rev['timestamp']}">${h.render_datetime(rev['timestamp'], with_hours=True)}</a></td>
+ <a href="${h.url_for(controller='package',action='read',id='%s@%s' % (c.pkg_dict['name'], rev['timestamp']))}" title="${_('Read dataset as of %s') % rev['timestamp']}">${h.render_datetime(rev['timestamp'], with_hours=True)}</a></td>
<td>${h.linked_user(rev['author'])}</td>
<td>${rev['message']}</td>
</tr>
================================================================
Compare: https://github.com/okfn/ckan/compare/b4ff647...76cb37a
More information about the ckan-changes
mailing list