diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-18 12:26:36 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-18 12:26:36 -0800 |
commit | ce7cda4436c558f3a73b0b1b687d4dea3663bbfc (patch) | |
tree | 536107ee13a2f05e31c44d4b34cb58d7f59f8b20 /python/fatcat_tools/transforms.py | |
parent | 0aae1c15ee6fd9f5173c3297d02b8aab912244d5 (diff) | |
download | fatcat-ce7cda4436c558f3a73b0b1b687d4dea3663bbfc.tar.gz fatcat-ce7cda4436c558f3a73b0b1b687d4dea3663bbfc.zip |
state in elasticsearch (and deleted/redirects)
Diffstat (limited to 'python/fatcat_tools/transforms.py')
-rw-r--r-- | python/fatcat_tools/transforms.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/python/fatcat_tools/transforms.py b/python/fatcat_tools/transforms.py index 0f957f9a..18bf7446 100644 --- a/python/fatcat_tools/transforms.py +++ b/python/fatcat_tools/transforms.py @@ -26,12 +26,18 @@ def release_to_elasticsearch(release): Raises exception on error (never returns None) """ - if release.state != 'active': - raise ValueError("Entity is not 'active'") + if release.state in ('redirect', 'deleted'): + return dict( + ident = release.ident, + state = release.state, + ) + elif release.state != 'active' + raise ValueError("Unhandled release state: {}".format(release.state)) # First, the easy ones (direct copy) t = dict( ident = release.ident, + state = release.state, revision = release.revision, title = release.title, release_type = release.release_type, |