Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow quoted dates in regex in before_index() #52

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ckanext/pdeu/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def before_index(self, dataset_dict):

# Change the Data Publica harvester's '2010-07-19T13:36:00'-formatted
# date strings into SOLR-compatible '1995-12-31T23:59:59Z' ones.
regex = ('^(?P<year>\d\d\d\d)-(?P<month>\d\d)-(?P<day>\d\d)'
'T(?P<hours>\d\d):(?P<minutes>\d\d):(?P<seconds>\d\d)$')
regex = ('^"?(?P<year>\d\d\d\d)-(?P<month>\d\d)-(?P<day>\d\d)'
'T(?P<hours>\d\d):(?P<minutes>\d\d):(?P<seconds>\d\d)"?$')
new_format = '{year}-{month}-{day}T{hours}:{minutes}:{seconds}Z'
for date_key in ('deposit_date', 'update_date'):
old_date_str = dataset_dict.get(date_key)
Expand Down