Stefan Oderbolz
c33c6e8c13
Raise an error instead of falling back to harvest_source_update
...
As the behaviour of *_patch is clearly different from the *_update we
should raise an error if this action is called on a CKAN instance, where
the action is not available.
2015-11-13 11:41:53 +01:00
Stefan Oderbolz
644fa49dd4
Make tests independent from cls.sysadmin
...
Generate unique harvest sources
2015-11-11 19:49:49 +01:00
Stefan Oderbolz
ffca5cc3da
Use new factory style for fixtures
...
- Remove default_source_dict from tests
- Replace setup_class with constructor
- Create mixin for harvest source fixture
- Replace assert with assert_equal where appropriate
- Replace assert with ok_
- Remove dependency to global SOURCE_DICT
- General refactoring of tests
2015-11-11 19:07:59 +01:00
Stefan Oderbolz
136fcb87d5
Make sure package_patch has a fallback for package_update on CKAN < 2.3
2015-11-11 11:37:23 +01:00
Stefan Oderbolz
359da2eb69
Add test class for harvest_source_patch
2015-11-11 11:34:01 +01:00
Stefan Oderbolz
3f09010039
Add harvest_source_patch to API
2015-11-11 05:39:29 +01:00
David Read
679ed421e9
Merge branch 'master' of github.com:ckan/ckanext-harvest into immediate-harvest
...
Conflicts:
ckanext/harvest/logic/action/update.py
2015-11-04 09:44:05 +00:00
David Read
f0207ad38f
Merge branch 'master' of github.com:ckan/ckanext-harvest into yhteentoimivuuspalvelut-job-reporting-fixes
2015-11-04 09:36:55 +00:00
David Read
cbe9b40e66
Merge branch 'master' of github.com:ckan/ckanext-harvest into revision-id-fix
2015-11-04 09:36:08 +00:00
David Read
f9da3654f8
[ #184 ] Fix tests for older ckan versions.
2015-11-03 23:27:52 +00:00
David Read
5fba056c59
[ #184 ] Add tests
2015-11-03 23:19:05 +00:00
David Read
77e5b89a01
Blank line needed.
2015-11-03 22:23:04 +00:00
David Read
8c1f7619cb
Fix code style to be more ckan-like whilst still pep8.
2015-11-03 22:08:46 +00:00
David Read
20531c0dda
Merge branch 'master' of github.com:ckan/ckanext-harvest into LondonAppDev-master
...
Conflicts:
ckanext/harvest/logic/action/update.py
ckanext/harvest/logic/validators.py
2015-11-03 22:02:49 +00:00
David Read
10685badb5
PEP8 based on #174
...
Conflicts:
ckanext/harvest/logic/action/delete.py
ckanext/harvest/logic/action/update.py
ckanext/harvest/logic/validators.py
2015-11-03 21:56:06 +00:00
David Read
5a5260ff0b
Add test for harvest_source_clear since the PEP8 changes were quite a lot there.
2015-11-03 21:42:39 +00:00
David Read
4f71612002
PEP8 based on #174
2015-11-03 20:30:11 +00:00
Mark Winterbottom
208d1c4185
Setting back to master.
2015-11-03 17:31:00 +00:00
David Read
91afc0e928
[ #178 ] Fix test for ckan 2.2, which does not suffer problem #180 .
2015-11-03 10:01:47 +00:00
David Read
f4f124c181
[ #178 ] Fix resouce_revision_id_fkey error. Fixes #178 .
2015-11-03 07:38:01 +00:00
David Read
59be6e2c71
Merge branch 'master' into db-error
...
Conflicts:
ckanext/harvest/queue.py
2015-11-03 00:57:14 +00:00
David Read
8a7bc9e1d8
Merge remote-tracking branch 'origin/master' into immediate-harvest
...
Conflicts:
README.rst
ckanext/harvest/commands/harvester.py
ckanext/harvest/logic/action/create.py
ckanext/harvest/logic/action/update.py
ckanext/harvest/logic/auth/update.py
2015-11-03 00:40:25 +00:00
David Read
c7fac36c1c
[ #107 ] "unchanged" response tested and related fixes
...
* fix "existing_package_dict" which wasn't containing metadata_modified (because of the schema in the context) so you never skipped an object.
* fix IntegrityError due to resource revision_id being harvested. No idea why this hasn't caused errors before now.
* "unchanged" is now checked in base instead of ckanharvester - makes sense. Looking at other harvesters, it's normal to return from the import_stage with the value returned from base._create_or_update_package so I've continued with that.
* "unchanged" response is now documented
* better report_status tests in test_queue2.
2015-11-03 00:22:53 +00:00
David Read
e59760fefe
Merge branch 'job-reporting-fixes' of https://github.com/yhteentoimivuuspalvelut/ckanext-harvest into yhteentoimivuuspalvelut-job-reporting-fixes
2015-11-02 21:25:32 +00:00
Mark Winterbottom
7ffd6748f3
Corrected docstring params field, duplicate if statement and deleting keys
...
for blank values.
2015-11-02 16:59:43 +00:00
Mark Winterbottom
443d690ac8
Fixed big typo error.
2015-11-02 16:45:16 +00:00
Mark Winterbottom
53f692b802
Merge remote-tracking branch 'remotes/upstream/master'
2015-11-02 16:00:14 +00:00
Mark Winterbottom
1702cf2f09
Remove ', None' on .get() calls because it's the default value.
2015-11-02 15:51:25 +00:00
Mark Winterbottom
0c19acba78
Changed double quotes to single quotes in docstrings.
2015-11-02 15:50:04 +00:00
Mark Winterbottom
a6069d93db
Fixed bug where the harvest source url validator would validate against
...
all harvest sources that were ever created instead of just sources that
were currently enabled.
2015-10-30 16:59:04 +00:00
Mark Winterbottom
3f37ae5f45
Corrected docstring.
2015-10-30 16:11:25 +00:00
Mark Winterbottom
02b81187df
Fixed bug with deleting harvest source's which have a custom
...
configuration. Added PEP-8 compliance.
2015-10-30 15:15:41 +00:00
Mark Winterbottom
55325f5940
Updated harvest source url validator to allow for duplicate URL's with
...
unique configs.
2015-10-30 11:59:24 +00:00
Mark Winterbottom
2c41293c9c
Updated the validator to check for unique sets as well as URL.
2015-10-29 18:30:51 +00:00
Mark Winterbottom
39ce744368
Modified to make PEP-8 compliant.
2015-10-29 17:18:51 +00:00
David Read
f1d2d5fdc4
[ #111 ] Run jobs straight away.
2015-10-28 21:58:36 +00:00
David Read
421e6da660
Add run_test, job_abort, source commands
...
* run_test - for running a whole harvest on the command-line
* job_abort - for aborting a limbo job
* source - for showing a single harvest source
* allowing a source to be specified by name in several commands
2015-10-28 17:51:58 +00:00
amercader
86630adab7
Merge branch 'include-exclude-org'
2015-10-27 15:52:55 +00:00
amercader
24574f485b
Setup harvest model in harvester tests
2015-10-23 15:43:01 +01:00
David Read
bc49149d5e
Merge branch 'master' into include-exclude-org
2015-10-23 14:36:53 +01:00
David Read
0c0a996b85
Merge branch 'master' into db-error
...
Conflicts:
ckanext/harvest/queue.py
2015-10-23 13:33:44 +01:00
amercader
2f4adfb338
Merge branch 'tests'
2015-10-23 13:18:15 +01:00
amercader
3c6cc55be0
Only flush keys on the current Redis database
2015-10-23 11:52:22 +01:00
amercader
fdbade465f
Merge branch 'master' into purge
2015-10-23 11:33:43 +01:00
amercader
d950b13400
Merge branch 'unique-names-improved'
2015-10-23 11:02:49 +01:00
amercader
501edffe2d
Merge branch 'master' into migration-states
2015-10-23 10:59:04 +01:00
David Read
3e4a9933ce
Remove prints.
2015-10-21 16:52:19 +00:00
David Read
dc7af5d150
Remove prints.
2015-10-21 16:38:03 +00:00
David Read
eb9aa17862
Include/exclude orgs funcationality based on work by memaldi and ross.
2015-10-21 16:33:16 +00:00
David Read
f70c16bce7
Add framework for testing harvesters. Modernize existing tests.
2015-10-21 16:26:57 +00:00
David Read
d1f84295f8
purge_queues command now has warning about impact of Redis flushall, plus add some (log) output when you run a purge.
2015-10-21 16:12:40 +00:00
David Read
6360681a8f
[ #105 ] Fix order of deletes, as agreed with @florianm.
2015-10-12 15:57:27 +01:00
David Read
82bdff2f34
Add tests
2015-10-01 17:59:17 +01:00
David Read
be3e88086a
Generating unique names improved
...
* Harvesters that change the name when the title changes have had a
problem when the change is small and a number was unnecessarily
appended. e.g. "Trees "->"Trees" meant _gen_new_name("Trees") returned
"trees1". Now you can specify the existing value and it will return
that if it still holds.
* Maximum dataset name length is now adhered to.
* To make a name unique, a sequential number is now added, since for
users that is more understandable and pleasant. However hex digits are
still an option, for those that want to harvest concurrently.
2015-10-01 17:53:03 +01:00
David Read
1a6dca7c00
[ #148 ] Catch a more specific exception.
2015-10-01 12:30:40 +01:00
Florian Mayer
a6cdda0a14
set max version to 2.4.99
2015-08-19 08:41:42 +00:00
florianm
1905caa961
upgrade harvest_source_clear to not delete from authz models removed in migration 078
2015-08-19 10:25:20 +08:00
David Read
de17e0ae8c
Catch, record and recover from temporary db problems.
2015-07-22 10:25:11 +01:00
David Read
46f7b32b04
Merge branch 'master' of github.com:okfn/ckanext-harvest into migration-states
2015-07-22 10:13:55 +01:00
David Read
2da918c2e4
Fix migration for old harvests so that ones that errored are correctly marked. Added helpful comments in model.
2015-07-22 10:13:02 +01:00
Stefan Oderbolz
ab76830e85
[ #145 ] Throw + catch a custom exception if there are no jobs to run
...
If there are no harvesting jobs to run, there was always an ugly
exception message when using the paster command. This replaces the ugly
output with a proper message and uses a custom exception to allow others
to deal with this error differently.
2015-07-20 18:41:50 +02:00
Stefan Oderbolz
83dd0b4b68
[ #138 ] Add data attributes to support timezone conversion
2015-07-09 22:35:54 +02:00
Stefan Oderbolz
4dc2f7367d
[ #139 ] Delete package relationships when clearing a harvest source
2015-06-26 17:20:23 +02:00
amercader
88d9ba0397
[ #136 ] Fix broken RabbitMQ queue names
...
The harvester command was still using the old ones.
Use specific ones for testing.
2015-06-11 13:56:22 +01:00
amercader
673dfc9882
[ #127 ] Use site user on the CKAN harvester
...
Add missing call
2015-06-11 10:38:33 +01:00
amercader
d3a3f09ad1
[ #127 ] Use site user on the CKAN harvester
...
To avoid having to create a 'harvest' sysadmin explicitly. It will still
be used if present, but if not the site user will be used. You can also
define to user to use via a config option.
2015-06-11 10:19:07 +01:00
amercader
b17c3269b5
Merge branch 'clear-command' of https://github.com/metaodi/ckanext-harvest into metaodi-clear-command
2015-06-10 15:32:37 +01:00
Stefan Oderbolz
64ff0f3a3a
Use single quotes to be consistent
2015-06-10 16:22:04 +02:00
Stefan Oderbolz
2a2d85f60c
Wording changes for clearsource and rmsource
2015-06-10 16:19:23 +02:00
joetsoi
92b93c53fc
add some translation strings
2015-06-10 12:14:20 +01:00
Stefan Oderbolz
8ebb843052
Add documentation for clearsource command
2015-06-10 11:29:24 +02:00
Stefan Oderbolz
61bc150ae6
Expose clear harvester source as a paster command
2015-06-10 11:19:10 +02:00
amercader
9f8aae3a18
Append site id to queue name
...
This allows multiple CKAN sites to share the same RabbitMQ exchange
(For the Redis backend this is handled via different Redis databases)
2015-06-01 17:54:22 +01:00
amercader
3e21ea4f82
Fix tests, set up Travis
...
TODO: sort out the tests properly, avoiding imports from the legacy ones
2015-04-07 13:31:45 +01:00
amercader
f72d6da521
Change toolkit import
...
Apparently on package installs this is not well supported
from ckan.plugins.toolkit import check_ckan_version
But this works:
from ckan.plugins import toolkit
toolkit.check_ckan_version(...
2015-03-19 12:48:46 +00:00
amercader
7a20e93716
Raise on startup import errors so we don't mask problems
...
Otherwise if there was eg an actual ImportError we jut got
2015-03-19 12:30:08,430 DEBUG [ckanext.harvest.plugin] No auth module
for action "update"
on the log
2015-03-19 12:48:15 +00:00
Jari Voutilainen
859133fe36
move detecting unchanged datasets to ckanharvester and queue.py
2015-03-10 14:48:41 +02:00
David Read
d6e9b80496
Merge pull request #118 from clementmouchet/114-remove_resource_groups
...
Removed ResourceGroup from query when using CKAN 2.3 or above
2015-02-24 09:56:44 +00:00
clementmouchet
ead9e67a33
updated def harvest_source_clear() to delete resource views, resource revisions & resources in CKAN >= 2.3
2015-02-23 17:02:21 +00:00
David Read
b3ed6cae5a
Merge pull request #121 from metaodi/120-create-remote-orgs
...
Fetch remote organization via action api
2015-01-15 10:49:09 +00:00
Stefan Oderbolz
c1bcee9684
Use str() to get the error message
2015-01-15 11:36:15 +01:00
Stefan Oderbolz
191c39ce5c
Catch the more general URLError instead of HTTPError
...
HTTPError is a subclass of URLError, so catch URLError is enough. I
think the HTTP error code is not as important in this situation, so
catching the more generic error seems like the best solution.
2015-01-15 10:57:24 +01:00
Stefan Oderbolz
b978c26e70
Use ContentFetchError instead of generic Exception
2015-01-15 00:49:11 +01:00
Stefan Oderbolz
935b9dda01
Munge group name before fetching remote group
...
The API call /api/2/rest/package/<id> returns the display name of the
group instead of its ID. To properly match the group, munge the name
before calling /api/2/rest/group
2015-01-15 00:44:53 +01:00
Stefan Oderbolz
ef35c21e2a
Improve exception handling with custom exception
...
1. Try whenever possible to catch specific exceptions
2. Raise custom exception where appropriate
3. Fix the exception handling in _get_group and _get_organization
2015-01-15 00:44:45 +01:00
Stefan Oderbolz
0fd38e0e54
Use _get_group as a fallback for remote orgs
...
First try to get a remote org from the remote Action API, if this fails
try to use the old rest api call, which works on older CKAN versions.
Only if both options fail, its currently not possible to get the remote
organization.
2015-01-14 00:10:27 +01:00
Stefan Oderbolz
f214577872
Fetch remote organization via action api
...
Organizations used to be returned by /api/2/rest/group, this is what the
old implementation used to fetch the information to create the remote
organization on the local instance of CKAN.
With this commit the Action API is used to fetch the same information.
2015-01-13 14:46:53 +01:00
Stefan Oderbolz
ea9debf714
Fix logic of conditional and make it more pythonic
2014-12-18 16:03:33 +01:00
Stefan Oderbolz
08930d01bf
Make sure for new packages get a unique 'name'
2014-12-16 15:02:36 +01:00
clementmouchet
82c7988bf3
Removed ResourceGroup from query when using CKAN 2.3 or above
2014-12-12 13:10:40 +00:00
amercader
a3affc9702
Fix validators on harvest_source_show schema
...
Remove validators on several keys so they don't get stripped during the
show validation.
2014-10-08 12:02:26 +01:00
amercader
098b54f1e5
Merge branch 'clear-source-delete-related' of https://github.com/waldvogel/ckanext-harvest into waldvogel-clear-source-delete-related
2014-09-29 13:49:19 +01:00
amercader
e60e2eee03
Fix output for harvest_source_create/update
...
They were using an incorrect schema, so not returning a harvest source
like dict.
2014-09-29 12:43:37 +01:00
waldvogel
c9b4e10506
delete records from related and related_dataset when clearing source
2014-09-12 10:56:37 +02:00
Jari Voutilainen
1e0376cff6
fix typo
2014-09-10 10:33:13 +03:00
Jari Voutilainen
f6c1456abe
fix job reporting to have job finished timestamp when there was zero datasets to gather
2014-09-10 09:22:55 +03:00
Jari Voutilainen
97f09913cf
fix job reporting all datasets deleted when actually nothing changed during last two harvests
2014-09-10 09:22:44 +03:00
amercader
8cf254f112
Merge branch '99-all-non-ascii-tags' of https://github.com/morty/ckanext-harvest into morty-99-all-non-ascii-tags
2014-08-29 14:40:43 +01:00
amercader
546159744e
Merge branch '101-modified-package-name' of https://github.com/morty/ckanext-harvest into morty-101-modified-package-name
2014-08-29 14:38:33 +01:00
amercader
039ac7c0ad
Always remove harvest extras on after_show if there
...
Up until now we where relying on `for_edit` being present in the
context, but this is only added on the controllers. It's better to be
safe and remove them always. If needed (at index time) they will be
added afterwards.
2014-08-14 15:31:39 +01:00