Skip to content

Commit

Permalink
Merge branch 'master' into 1449-cant-delete-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jan 27, 2014
2 parents 55959f6 + bb70fc5 commit da20b2c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
4 changes: 4 additions & 0 deletions ckan/lib/helpers.py
Expand Up @@ -38,6 +38,7 @@
import ckan.lib.datapreview as datapreview
import ckan.logic as logic
import ckan.lib.uploader as uploader
import ckan.new_authz as new_authz

from ckan.common import (
_, ungettext, g, c, request, session, json, OrderedDict
Expand Down Expand Up @@ -1753,6 +1754,8 @@ def get_site_statistics():

return stats

def check_config_permission(permission):
return new_authz.check_config_permission(permission)

# these are the functions that will end up in `h` template helpers
__allowed_functions__ = [
Expand Down Expand Up @@ -1855,4 +1858,5 @@ def get_site_statistics():
'get_featured_organizations',
'get_featured_groups',
'get_site_statistics',
'check_config_permission',
]
4 changes: 2 additions & 2 deletions ckan/logic/validators.py
Expand Up @@ -33,8 +33,8 @@ def owner_org_validator(key, data, errors, context):
user = context['user']
user = model.User.get(user)
if value == '' :
if new_authz.check_config_permission('create_unowned_dataset'):
return
if not new_authz.check_config_permission('create_unowned_dataset'):
raise Invalid(_('A organization must be supplied'))
# only sysadmins can remove datasets from org
if not user.sysadmin:
raise Invalid(_('You cannot remove a dataset from an existing organization'))
Expand Down
13 changes: 0 additions & 13 deletions ckan/public/base/vendor/jquery.ui.widget.min.js

This file was deleted.

4 changes: 3 additions & 1 deletion ckan/templates/package/snippets/package_basic_fields.html
Expand Up @@ -69,7 +69,9 @@
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label>
<div class="controls">
<select id="field-organizations" name="owner_org" data-module="autocomplete">
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option>
{% if h.check_config_permission('create_unowned_dataset') %}
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option>
{% endif %}
{% for organization in organizations_available %}
{# get out first org from users list only if there is not an existing org #}
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %}
Expand Down
11 changes: 7 additions & 4 deletions ckanext/datapusher/logic/action.py
Expand Up @@ -45,9 +45,12 @@ def datapusher_submit(context, data_dict):

datapusher_url = pylons.config.get('ckan.datapusher.url')

callback_url = p.toolkit.url_for(
controller='api', action='action', logic_function='datapusher_hook',
ver=3, qualified=True)
site_url = pylons.config['ckan.site_url']

callback_url = site_url.rstrip('/') + p.toolkit.url_for(
controller='api', action='action',
logic_function='datapusher_hook', ver=3
)

user = p.toolkit.get_action('user_show')(context, {'id': context['user']})

Expand Down Expand Up @@ -86,7 +89,7 @@ def datapusher_submit(context, data_dict):
'job_type': 'push_to_datastore',
'result_url': callback_url,
'metadata': {
'ckan_url': pylons.config['ckan.site_url'],
'ckan_url': site_url,
'resource_id': res_id,
'set_url_type': data_dict.get('set_url_type', False)
}
Expand Down
6 changes: 4 additions & 2 deletions ckanext/textpreview/tests/test_preview.py
Expand Up @@ -114,8 +114,10 @@ def test_css_included(self):
result = self.app.get(url, status='*')

assert result.status == 200, result.status
assert 'text.css' in result.body, result.body
assert 'github.css' in result.body, result.body
assert (('text.css' in result.body)
or ('text.min.css' in result.body)), result.body
assert (('github.css' in result.body)
or ('github.min.css' in result.body)), result.body

def test_iframe_is_shown(self):
url = h.url_for(controller='package', action='resource_read',
Expand Down

0 comments on commit da20b2c

Please sign in to comment.