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

Check all date field for year before 1900 #263

Open
sweemeng opened this issue Jun 12, 2017 · 1 comment
Open

Check all date field for year before 1900 #263

sweemeng opened this issue Jun 12, 2017 · 1 comment

Comments

@sweemeng
Copy link
Member

Currently it is breaking indexing's own checking because we have a year of value 1068

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/apps/popit_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/opt/apps/popit_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/apps/popit_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/apps/popit_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/opt/apps/hluttaw/popit_ng/popit_search/management/commands/reindex.py", line 67, in handle
    popit_indexer(entity)
  File "/opt/apps/hluttaw/popit_ng/popit_search/utils/search.py", line 529, in popit_indexer
    bulk_indexer.index_data(to_index)
  File "/opt/apps/hluttaw/popit_ng/popit_search/utils/search.py", line 417, in index_data
    es_id=es_id, doc_type=entity_name, ops=ops, body=body
  File "/opt/apps/hluttaw/popit_ng/popit_search/utils/search.py", line 436, in create_bulk_entry
    body = sanitize_data(body)
  File "/opt/apps/hluttaw/popit_ng/popit_search/utils/search.py", line 543, in sanitize_data
    output[key] = new_date.strftime("%Y-%m-%dT%H%M%S")
ValueError: year=1068 is before 1900; the datetime strftime() methods require year >= 1900
@sweemeng
Copy link
Member Author

dateutils parser is working correctly, but strftime refuse to convert back into text, this is important because elasticsearch only accept data as text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant