Skip to content

Commit

Permalink
Merge branch 'master' into 2845-wsgi-dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Mar 10, 2016
2 parents 882890c + 78b5d55 commit 6e05650
Show file tree
Hide file tree
Showing 21 changed files with 347 additions and 342 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,10 @@
### CKAN Version if known (or site URL)


### Please describe the expected behaviour


### Please describe the actual behaviour


### What steps can be taken to reproduce the issue?
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,15 @@
Fixes #

### Proposed fixes:



### Features:

- [ ] includes tests covering changes
- [ ] includes updated documentation
- [ ] includes user-visible changes
- [ ] includes API changes
- [ ] includes bugfix for possible backport

Please [X] all the boxes above that apply
14 changes: 12 additions & 2 deletions .travis.yml
@@ -1,10 +1,20 @@
language: python
sudo: required
python:
- "2.6"
- "2.7"
env:
- PGVERSION=9.1
- PGVERSION=8.4
global:
- CKAN_POSTGRES_DB=ckan_test
- CKAN_POSTGRES_USER=ckan_default
- CKAN_POSTGRES_PWD=pass
- CKAN_DATASTORE_POSTGRES_DB=datastore_test
- CKAN_DATASTORE_POSTGRES_WRITE_USER=ckan_default
- CKAN_DATASTORE_POSTGRES_READ_USER=datastore_default
- CKAN_DATASTORE_POSTGRES_READ_PWD=pass
matrix:
- PGVERSION=9.1
- PGVERSION=8.4
matrix:
exclude:
- python: "2.7"
Expand Down
6 changes: 6 additions & 0 deletions bin/postgres_init/1_create_ckan_db.sh
@@ -0,0 +1,6 @@
#!/bin/sh
psql -U postgres -c "CREATE USER ${CKAN_POSTGRES_USER} \
WITH PASSWORD '${CKAN_POSTGRES_PWD}' \
NOSUPERUSER NOCREATEDB NOCREATEROLE;"

createdb -U postgres -e -O ${CKAN_POSTGRES_USER} ${CKAN_POSTGRES_DB} -E utf-8
14 changes: 14 additions & 0 deletions bin/postgres_init/2_create_ckan_datastore_db.sh
@@ -0,0 +1,14 @@
#!/bin/sh
if [ "${CKAN_DATASTORE_POSTGRES_DB}" ]; then
psql -U postgres -c "CREATE USER ${CKAN_DATASTORE_POSTGRES_READ_USER} \
WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_READ_PWD}' \
NOSUPERUSER NOCREATEDB NOCREATEROLE;"

if [ "${CKAN_DATASTORE_POSTGRES_WRITE_USER}" ] && [ "${CKAN_DATASTORE_POSTGRES_WRITE_PWD}" ]; then
psql -U postgres -c "CREATE USER ${CKAN_DATASTORE_POSTGRES_WRITE_USER} \
WITH PASSWORD '${CKAN_DATASTORE_POSTGRES_WRITE_PWD}' \
NOSUPERUSER NOCREATEDB NOCREATEROLE;"
fi

createdb -U postgres -e -O ${CKAN_DATASTORE_POSTGRES_WRITE_USER} ${CKAN_DATASTORE_POSTGRES_DB} -E utf-8
fi
6 changes: 2 additions & 4 deletions bin/travis-install-dependencies
Expand Up @@ -25,10 +25,8 @@ fi
sudo service postgresql restart

# Setup postgres' users and databases
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c "CREATE USER datastore_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;'
sudo -E -u postgres ./bin/postgres_init/1_create_ckan_db.sh
sudo -E -u postgres ./bin/postgres_init/2_create_ckan_datastore_db.sh

export PIP_USE_MIRRORS=true
pip install -r requirements.txt --allow-all-external
Expand Down
13 changes: 9 additions & 4 deletions circle.yml
Expand Up @@ -2,6 +2,13 @@ machine:

environment:
PIP_USE_MIRRORS: true
CKAN_POSTGRES_DB: ckan_test
CKAN_POSTGRES_USER: ckan_default
CKAN_POSTGRES_PWD: pass
CKAN_DATASTORE_POSTGRES_DB: datastore_test
CKAN_DATASTORE_POSTGRES_WRITE_USER: ckan_default
CKAN_DATASTORE_POSTGRES_READ_USER: datastore_default
CKAN_DATASTORE_POSTGRES_READ_PWD: pass

dependencies:
override:
Expand All @@ -14,10 +21,8 @@ dependencies:

database:
post:
- sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
- sudo -u postgres psql -c "CREATE USER datastore_default WITH PASSWORD 'pass';"
- sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
- sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;'
- sudo -E -u postgres ./bin/postgres_init/1_create_ckan_db.sh
- sudo -E -u postgres ./bin/postgres_init/2_create_ckan_datastore_db.sh
- sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/datastore_default:pass@\/datastore_test/' test-core.ini
- paster datastore -c test-core.ini set-permissions | sudo -u postgres psql

Expand Down
5 changes: 4 additions & 1 deletion ckan/controllers/user.py
Expand Up @@ -323,7 +323,10 @@ def _save_edit(self, id, context):
context['message'] = data_dict.get('log_message', '')
data_dict['id'] = id

if data_dict['password1'] and data_dict['password2']:
email_changed = data_dict['email'] != c.userobj.email

if (data_dict['password1'] and data_dict['password2']) \
or email_changed:
identity = {'login': c.user,
'password': data_dict['old_password']}
auth = authenticator.UsernamePasswordAuthenticator()
Expand Down
38 changes: 0 additions & 38 deletions ckan/lib/cli.py
Expand Up @@ -186,9 +186,6 @@ class ManageDb(CkanCommand):
db upgrade [version no.] - Data migrate
db version - returns current version of data schema
db dump FILE_PATH - dump to a pg_dump file
db simple-dump-csv FILE_PATH - dump just datasets in CSV format
db simple-dump-json FILE_PATH - dump just datasets in JSON format
db user-dump-csv FILE_PATH - dump user information to a CSV file
db load FILE_PATH - load a pg_dump from a file
db load-only FILE_PATH - load a pg_dump from a file but don\'t do
the schema upgrade or search indexing
Expand Down Expand Up @@ -239,12 +236,6 @@ def command(self):
self.load()
elif cmd == 'load-only':
self.load(only_load=True)
elif cmd == 'simple-dump-csv':
self.simple_dump_csv()
elif cmd == 'simple-dump-json':
self.simple_dump_json()
elif cmd == 'user-dump-csv':
self.user_dump_csv()
elif cmd == 'create-from-model':
model.repo.create_db()
if self.verbose:
Expand Down Expand Up @@ -326,35 +317,6 @@ def load(self, only_load=False):
print 'Now remember you have to call \'db upgrade\' and then \'search-index rebuild\'.'
print 'Done'

def simple_dump_csv(self):
import ckan.model as model
if len(self.args) < 2:
print 'Need csv file path'
return
dump_filepath = self.args[1]
import ckan.lib.dumper as dumper
dump_file = open(dump_filepath, 'w')
dumper.SimpleDumper().dump(dump_file, format='csv')

def simple_dump_json(self):
import ckan.model as model
if len(self.args) < 2:
print 'Need json file path'
return
dump_filepath = self.args[1]
import ckan.lib.dumper as dumper
dump_file = open(dump_filepath, 'w')
dumper.SimpleDumper().dump(dump_file, format='json')

def user_dump_csv(self):
if len(self.args) < 2:
print 'Need csv file path'
return
dump_filepath = self.args[1]
import ckan.lib.dumper as dumper
dump_file = open(dump_filepath, 'w')
dumper.UserDumper().dump(dump_file)

def migrate_filestore(self):
from ckan.model import Session
import requests
Expand Down
108 changes: 0 additions & 108 deletions ckan/lib/dumper.py

This file was deleted.

17 changes: 17 additions & 0 deletions ckan/plugins/interfaces.py
Expand Up @@ -179,9 +179,21 @@ class IDomainObjectModification(Interface):
"""

def notify(self, entity, operation):
"""
Send a notification on entity modification.
:param entity: instance of module.Package.
:param operation: 'new', 'changed' or 'deleted'.
"""
pass

def notify_after_commit(self, entity, operation):
"""
Send a notification after entity modification.
:param entity: instance of module.Package.
:param operation: 'new', 'changed' or 'deleted'.
"""
pass


Expand All @@ -191,6 +203,11 @@ class IResourceUrlChange(Interface):
"""

def notify(self, resource):
"""
Give user a notify is resource url has changed.
:param resource, instance of model.Resource
"""
pass


Expand Down

0 comments on commit 6e05650

Please sign in to comment.