You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
B2SAFE changed the PID profile and renamed the PID entry 'CHECKSUM' to 'EUDAT/CHECKSUM'.
The reverse-lookup function however only searches through keys ['URL', 'CHECKSUM']:
Note: If allowed search keys are configured, only these are used. If no allowed search keys are specified, all key-value pairs are passed on to the reverse lookup servlet, possibly causing a ReverseLookupException.
:param allowed_search_keys: Optional. The keys that can be used for
reverse lookup of handles, as a list of strings. Defaults to 'URL'
and 'CHECKSUM'. If the list is empty, all keys are passed to the
reverse lookup servlet and exceptions are passed on to the user.
I cannot give them as an extra parameter in the standard B2HANDLE v 1.1.1:
In [5]: b2handle.__version__
Out[5]: '1.1.1'
In [6]: cred = PIDClientCredentials.load_from_JSON('cred_21.T12995.json')
In [7]: ec = EUDATHandleClient.instantiate_with_credentials(cred)
In [8]: rev = dict([('CHECKSUM', '*')])
In [9]: allowedKeys = ['EUDAT/CHECKSUM', 'TYPE']
In [10]: result = ec.search_handle(**rev, allowedKeys)
File "<ipython-input-10-1bf44e457d41>", line 1
result = ec.search_handle(**rev, allowedKeys)
^
SyntaxError: invalid syntax
:param allowed_search_keys: Optional. The keys that can be used for
reverse lookup of handles, as a list of strings. Defaults to 'URL'
and 'CHECKSUM'. If the list is empty, all keys are passed to the
reverse lookup servlet and exceptions are passed on to the user.
Works now for me. But the documentation does not state how to enable additional keys.
Can you add a line like this in the documentation of that function:
You can define the allowed search keys by adding:
"allowed_search_keys": ["KEY1", "KEY2", ...],
to your credentials file.
Note that this is not a list with which the predefined keys are extended, but it overwrites the predefined keys.
In principle, you are right - since it is the same user who calls a constructor with the allowed_search_keys parameter and then uses the search method, it does not make sense to have this restriction.
There must have been a specific reason why this peculiar construct ended up in the library, probably related to the way b2handle is used in EUDAT. But to me this is not a concise argument for having this.
So my vote goes to abandoning the allowed_search_keys parameter. Robert, do you agree?
Activity
cookie33 commentedon May 1, 2017
Hi,
This is no real issue. Add one line to the credentials file and you are able to search to whatever you like. This is mentioned in: http://eudat-b2safe.github.io/B2HANDLE/handleclient.html?highlight=search#b2handle.handleclient.EUDATHandleClient.search_handle
The documentation states:
Note: If allowed search keys are configured, only these are used. If no allowed search keys are specified, all key-value pairs are passed on to the reverse lookup servlet, possibly causing a ReverseLookupException.
cookie33 commentedon May 1, 2017
The parameter to add is:
allowed_search_keyschStaiger commentedon May 1, 2017
How do I configure "allowed search keys"?
I cannot give them as an extra parameter in the standard B2HANDLE v 1.1.1:
cookie33 commentedon May 1, 2017
The parameter to add is:
allowed_search_keyscookie33 commentedon May 1, 2017
For a most easy usage add it to the credentials file.
chStaiger commentedon May 1, 2017
Works now for me. But the documentation does not state how to enable additional keys.
Can you add a line like this in the documentation of that function:
You can define the allowed search keys by adding:
to your credentials file.
Note that this is not a list with which the predefined keys are extended, but it overwrites the predefined keys.
chStaiger commentedon May 1, 2017
Since the user is allowed to define the search keys, why not make it a real parameter in the function?
TobiasWeigel commentedon May 5, 2017
In principle, you are right - since it is the same user who calls a constructor with the allowed_search_keys parameter and then uses the search method, it does not make sense to have this restriction.
There must have been a specific reason why this peculiar construct ended up in the library, probably related to the way b2handle is used in EUDAT. But to me this is not a concise argument for having this.
So my vote goes to abandoning the allowed_search_keys parameter. Robert, do you agree?
cookie33 commentedon May 8, 2017
I am also OK with removing the
allowed_search_keysparameter in a next version.