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

Update groups metadata #51

Merged
merged 2 commits into from
May 29, 2018
Merged

Update groups metadata #51

merged 2 commits into from
May 29, 2018

Conversation

ChiaraBi
Copy link
Member

No description provided.

Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, some minor fixes and we're 💯 and :shipit:

update_metadata_form = UpdateMetadataForm()
message = None
if update_metadata_form.validate_on_submit():
dir_path = request.form['dir_path']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with this is that the path that is passed might not be available on the server (this is especially true for e.g. OpenShift applications which are just running in a docker container), unless it's some kind of network mount which would always be there consistently.

What would rather make sense is uploading a zip/tar, though this might complicate things a bit for this admin view.

I would say let's create an issue for the Admin-UI where we can keep track of this and other useful views we can add in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I didn't think about it!
I created an issue here: #53

EventAPI.handle_event(event, no_index=True, delayed=False)
except ValueError:
pass
update_group_metadata(identifiers[0], data.get('Object'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to do a db.session.commit() at the end of this function to seal the deal (this might also be the reason why the single-payload-update you mentioned didn't work).

@@ -64,6 +65,80 @@ def off_test_simple_id_group_merge(db):
assert Identifier2Group.query.count() == 5


def test_update_groups(db):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test might be a better fit for test_metadata.py (or test_cli.py). We'll have to restructure tests in general though, so let's make an issue instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created this issue: #52

@ChiaraBi ChiaraBi force-pushed the update_metadata branch 2 times, most recently from fb19d25 to aa5a335 Compare May 14, 2018 13:55
@@ -452,3 +452,11 @@ def update_metadata(relationship: Relationship, payload):
rel_metadata.update(
{k: v for k, v in payload.items()
if k in ('LinkPublicationDate', 'LinkProvider')})


def update_group_metadata(identifier, payload):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use simple/primitive values as parameters to functions, and in this case identifiers is a dictionary with a specific format, which means that you would have to document it.

Maybe it's better to have something like def update_group_metadata(id_value, id_scheme, payload):

@slint slint force-pushed the update_metadata branch from e5b1265 to d4e7233 Compare May 29, 2018 18:49
@slint slint merged commit 16889f7 into asclepias:master May 29, 2018
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

Successfully merging this pull request may close these issues.

2 participants