Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into remove-vdm
- Loading branch information
Showing
813 changed files
with
6,411 additions
and
130,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ tmp/* | |
solr_runtime/* | ||
fl_notes.txt | ||
*.ini | ||
!ckan/migration/alembic.ini | ||
.noseids | ||
*~ | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# encoding: utf-8 | ||
|
||
import logging | ||
|
||
import click | ||
|
||
from ckan.cli import error_shout | ||
import ckan.lib.config_tool as ct | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class ConfigOption(click.ParamType): | ||
name = u'config-option' | ||
|
||
def convert(self, value, param, ctx): | ||
if u'=' not in value: | ||
self.fail( | ||
u'An option does not have an equals sign. ' | ||
u'It should be \'key=value\'. If there are spaces ' | ||
u'you\'ll need to quote the option.\n' | ||
) | ||
return value | ||
|
||
|
||
@click.command( | ||
name=u'config-tool', | ||
short_help=u'Tool for editing options in a CKAN config file.' | ||
) | ||
@click.option( | ||
u'--section', | ||
u'-s', | ||
default=u'app:main', | ||
help=u'Section of the config file' | ||
) | ||
@click.option( | ||
u'--edit', | ||
u'-e', | ||
is_flag=True, | ||
help=u'Checks the option already exists in the config file.' | ||
) | ||
@click.option( | ||
u'--file', | ||
u'-f', | ||
u'merge_filepath', | ||
help=u'Supply an options file to merge in.' | ||
) | ||
@click.argument(u'config_filepath', type=click.Path(exists=True)) | ||
@click.argument(u'options', nargs=-1, type=ConfigOption()) | ||
def config_tool(config_filepath, options, section, edit, merge_filepath): | ||
u'''Tool for editing options in a CKAN config file | ||
paster config-tool <default.ini> <key>=<value> [<key>=<value> ...] | ||
paster config-tool <default.ini> -f <custom_options.ini> | ||
Examples: | ||
paster config-tool default.ini sqlalchemy.url=123 'ckan.site_title=ABC' | ||
paster config-tool default.ini -s server:main -e port=8080 | ||
paster config-tool default.ini -f custom_options.ini | ||
''' | ||
|
||
if merge_filepath: | ||
ct.config_edit_using_merge_file( | ||
config_filepath, merge_filepath | ||
) | ||
if not (options or merge_filepath): | ||
return error_shout(u'No options provided') | ||
try: | ||
ct.config_edit_using_option_strings( | ||
config_filepath, options, section, edit=edit | ||
) | ||
except ct.ConfigToolError as e: | ||
error_shout(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# encoding: utf-8 | ||
|
||
import logging | ||
|
||
import click | ||
|
||
from ckan.lib.create_test_data import CreateTestData | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
@click.group(short_help=u'Create test data in the database.') | ||
def seed(): | ||
u'''Create test data in the database. | ||
Tests can also delete the created objects easily with the delete() method. | ||
''' | ||
pass | ||
|
||
|
||
@seed.command(short_help=u'Annakarenina and warandpeace.') | ||
@click.pass_context | ||
def basic(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_basic_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Realistic data to test search.') | ||
@click.pass_context | ||
def search(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_search_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Government style data.') | ||
@click.pass_context | ||
def gov(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_gov_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Package relationships data.') | ||
@click.pass_context | ||
def family(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_family_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Create a user "tester" with api key "tester".') | ||
@click.pass_context | ||
def user(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_test_user() | ||
click.echo( | ||
u'Created user {0} with password {0} and apikey {0}'.format(u'tester') | ||
) | ||
|
||
|
||
@seed.command(short_help=u'Test translations of terms.') | ||
@click.pass_context | ||
def translations(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_translations_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Some test vocabularies.') | ||
@click.pass_context | ||
def vocabs(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_vocabs_test_data() | ||
|
||
|
||
@seed.command(short_help=u'Hierarchy of groups.') | ||
@click.pass_context | ||
def hierarchy(ctx): | ||
flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app | ||
with flask_app.test_request_context(): | ||
CreateTestData.create_group_hierarchy_test_data() |
Oops, something went wrong.