-
Notifications
You must be signed in to change notification settings - Fork 19
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
models: add override column #81
Conversation
" +-- Collection <id: 8, name: h, dbquery: None, " | ||
"override: False>\n " | ||
" +-- Collection <id: 10, name: j, dbquery: title:Test4, " | ||
"override: False>\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's one reason I don't like PEP8's 79 characters hard limit... : )
Signed-off-by: Jacopo Notarstefano <[email protected]>
I fine with the solution in this PR, I just want to highlight a similar problem in OAIServer which may or may not work in this case (and I'm not sure how much work it would be to adapt the code). In Invenio-OAIServer, for some OAI-PMH setspecs we just want to put them manually into The way it works in OAIServer for a setspec you want to manage manually is that you simply set the dbquery to an empty string, and then the system won't mess with the set. If a record is in an OAI setspec it will stay there, if it's not there it won't be added unless you do it yourself. Regarding this PR, then the only thing I'm struggling a bit with is the name |
I don't like either, but it's the best I could come up with while rubber ducking a colleague... What I meant to say is "skip checking if the record matches the query and assume that it does", not unlike your OAIServer use case. That is, I thought, "override" the query. I also thought about "skip", but didn't like it because one might think that it means "skip adding this collection", not "skip running this query". "skipmatching" is clearer, but quite awkward... |
@jacquerie What about |
I like
Would you rather do something like for name, data in iteritems(collections):
if data['query'] == '' or _build_query(data['query']).match(record):
yield data['ancestors'] where we currently have invenio-collections/invenio_collections/receivers.py Lines 68 to 70 in 3105405
? |
Wait, both approaches won't work! They would just add ALL the collections to ALL the records... |
This proved to be too complicated to implement correctly and with the minimal impact to |
Here's what I meant in #72 (comment): it's not the most elegant solution, but it's a pragmatic one.
Adding a new column requires a new Alembic recipe, which is still missing from this PR, but I wanted to have an external opinion before continuing.