by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Lars Holm Nielsen
@lnielsen
End of june we should be a usable state, if you want to live at the cutting edge…..
@dfdan Thanks
Colin Sippl
@cs-ubr
@lnielsen I'll definitely have a closer look at it! Maybe I can pick up some of it.
Nicola
@ntarocco
@cs-ubr I assume a common deposit module for all three types would work with something like an 'all-deposit-records' index alias covering all three deposit indices I am not sure I understand if you refer to the default implemenation of invenio-deposit or to a custom implementation that you would like to develop. In any case, when you go for 1 index only, that you will have to search/filter results per pid_type, while multiple indices will allow you only to query the right index per pid_type.
About the posting, if you use REST APIs to post, you should probably create the deposit first, then use hte action publish. The risk otherwise is that if there is an error in the published record, when you will try to edit, it will fail.
ugswork
@ugswork
When I add permissions to RECORDS_REST_ENDPOINTS and use the REST API, since the owner is not identified, the permission always returns false. What do I need to do in order to allow records to be modified by REST API for example, only by the owner correctly. Thank you.
Nicola
@ntarocco

When I add permissions to RECORDS_REST_ENDPOINTS and use the REST API, since the owner is not identified, the permission always returns false. What do I need to do in order to allow records to be modified by REST API for example, only by the owner correctly. Thank you.

@ugswork you need to have the owner logged in right? in this case, here an example: you create a class that checks a specific field in the record, e.g. this one checks for a field patron_pid and then use it like this. I would recommend you to write tests too to make sure it is working correctly and only for a specific owner.

ugswork
@ugswork
@ntarocco I am using Invenio v3.0.2. I installed invenio-app-ils. But I see a conflict between the version of invenio-records-restrequired by invenio and invenio-app-ils. I am looking into how to resolve it, in order to do further testing on patron_pid. (I also do not see patron_pid saved as part of a record).
ugswork
@ugswork
I have another question related to curate. I have a few inclusion requests created for certain records to be added to certain communities. When I get to the curate page of a community, I see all the records listed on the curate page, when I expect to see only those records which have inclusion requests to that specific community. What do i need to do to get this working correctly? Is there anything more needs to be done related to inclusion requests? I have asked this question before and would greatly appreciate a response. If this does not work, i will create another page similar to the curate pageto display only the records with inclusion requests. Before I do that, thought of posting this question. Thank you.
Nicola
@ntarocco

@ntarocco I am using Invenio v3.0.2. I installed invenio-app-ils. But I see a conflict between the version of invenio-records-restrequired by invenio and invenio-app-ils. I am looking into how to resolve it, in order to do further testing on patron_pid. (I also do not see patron_pid saved as part of a record).

@ugswork patron_pid is an example, you have to change it for the field in your record...

Lanxin Ma
@malanxin_gitlab
Hello, I've installed an Invenio3 instance. I can only access it by linking to https://127.0.0.1:5000 , I want to access it by its real IP or hostname , i.e. https://myhostname.com, should I change configure file ? how to do it ? Thanks a lot,
Nicola
@ntarocco
@malanxin_gitlab if you need this in your local development env, you could change the /etc/hosts file and add a new line with 127.0.0.1 myhostname.com. If you need this for deployment in production, you should probably have a reverse proxy in front of Invenio uWSGI
Lanxin Ma
@malanxin_gitlab
@ntarocco Thanks a lot, is there any guide about config a reverse proxy in front of Invenio uWSGI ?
Nicola
@ntarocco
@malanxin_gitlab this really depends on your deployment environment. I would recommend you to read more here and here and to have a look to the docker-compose example here but this is not meant to be production ready. It is just an example!
Lanxin Ma
@malanxin_gitlab
@ntarocco Thanks a lot
prog20901
@prog20901
Can someone help me to understand the algorithm or logic specified in view-source:https://georgjaehnig.github.io/booklet-page-calculator/ ?
Johnny Mariéthoz
@jma
Hello does anyone a ready to use invenio-oauthclient configuration for an ... invenio application? Should be nice to have it in the contrib directory... Thanks in advance.
Peter Weber
@rerowep
Hello it is possible to redirect to different pages depends on user role after login using https://github.com/inveniosoftware/invenio-access? Thanks for help.
Colin Sippl
@cs-ubr

@ntarocco Hi, I have two general questions about indexing record drafts with invenio-deposit:

a) Initially, all the records I posted to api/deposit would end up in the wrong 'records' index. I discovered by accident that only after changing INDEXER_DEFAULT_INDEX to 'deposits' in my main config.py, records are stored correctly in the 'deposits' index. This surprises me because all my data models (e.g. records, authors) have different indices and DEPOSIT_UI_SEARCH_INDEX (invenio-deposit config.py) is set to 'deposits' by default. So..., why changing the default configuration? However, the default settings of invenio-indexer(INDEXER_DEFAULT_INDEX = "records-record-v1.0.0") are used whitin invenio-deposit. Is this simply due to the provisional nature of the module?

b) Well, after posting records to api/deposit indexation doesn't happen immediately. The records only show up in the index as soon as you access the deposit GUI (e.g. my-site.com/deposit). Why is that?

ugswork
@ugswork
I created a new index with a slightly different name and removed the old index records-record-v1.0.0. I see that INDEXER_DEFAULT_INDEX and INDEXER_DEFAULT_DOC_TYPE are used by the indexer, for creating the new index. But while running the app i get index_not_found_exception and I am trying to find how to make the app use the new index. The above mentioned 2 config variables are not used. Is there any other config variable that needs to be used? Thank you.
ugswork
@ugswork
I am trying to see how to recover from the following error. Occurs while running scripts/setup.py. I am using Invenio v3.0.2. Haven't had this error so far. Any feedback on how to recover from this will be very helpful. Thank you.
> ./scripts/setup.py
Cache cleared
Destroying database postgresql+psycopg2://set-repository:set-repository@localhost/set-repository
Creating database postgresql+psycopg2://set-repository:set-repository@localhost/set-repository
Creating all tables!
  [####################################]  100%
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
Created all tables!
Destroying indexes...
Creating indexes...
PUT http://localhost:9200/records-record-v1.0.0/_alias/records [status:404 request:0.006s]
Traceback (most recent call last):
  File "<venv>/bin/invenio", line 8, in <module>
    sys.exit(cli())
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/flask/cli.py", line 557, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/flask/cli.py", line 412, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/invenio_search/cli.py", line 44, in inner
    return f(*args, **kwargs)
  File "<venv>/lib/python3.7/site-packages/invenio_search/cli.py", line 74, in init
    for name, response in bar:
  File "<venv>/lib/python3.7/site-packages/click/_termui_impl.py", line 285, in generator
    for rv in self.iter:
  File "<venv>/lib/python3.7/site-packages/invenio_search/ext.py", line 265, in create
    for result in _create(self.active_aliases):
  File "<venv>/lib/python3.7/site-packages/invenio_search/ext.py", line 248, in _create
    for result in _create(value, alias=name):
  File "<venv>/lib/python3.7/site-packages/invenio_search/ext.py", line 262, in _create
    ignore=ignore,
  File "<venv>/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
    return func(*args, params=params, **kwargs)
  File "<venv>/lib/python3.7/site-packages/elasticsearch/client/indices.py", line 337, in put_alias
    '_alias', name), params=params, body=body)
  File "<venv>/lib/python3.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
    status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
  File "<venv>/lib/python3.7/site-packages/elasticsearch/connection/http_requests.py", line 90, in perform_request
    self._raise_error(response.status_code, raw_data)
  File "<venv>/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 125, in _raise_error
    raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.NotFoundError: NotFoundError(404, 'index_not_found_exception', 'no such index')
Lars Holm Nielsen
@lnielsen
@ugswork the error means that the index hasn’t been created, and therefore cannot be found when it’s trying to create an alias
ugswork
@ugswork
@lnielsen I think i did not word my message correctly. I understand that the error indicates that the index is absent, while aliasing. It is usually done as part of the setup.py, and it is not clear why it is not created. I tried pulling a new image of elasticsearch, tried creating it using the invenio index create ... command etc. I will look at any errors in ES log . Meanwhile I also wanted to ask here. I checked the ES mapping and it was used to create an index before without errors. Thank you.
Lauren-D
@lauren-d
@ugswork did you check if all indexes created with something like curl -X GET "localhost:9200/_cat/indices » or in a browser withhttp://localhost:9200/_cat/indices ? Maybe there is an error while creating the records index (before aliasing).
Other tips, in case of using Docker, stop and remove containers with docker-compose down (maybe you must delete docker volume too) and restart container to have clean services before run setup
Dan Granville
@dfdan
Can you easily set the number of search results displayed by default (Invenio 3.2, so react)? I tried changing RECORDS_REST_DEFAULT_RESULTS_SIZE but something (in search-ui / search-js?) still asks for 20 explicitly...
Nicola
@ntarocco

Hello it is possible to redirect to different pages depends on user role after login using https://github.com/inveniosoftware/invenio-access? Thanks for help.

Just a quick thought: I think you need to have a look to flask-login, invenio-accounts uses it heavily... but I didn't check in details the code and the possibilities

Lars Holm Nielsen
@lnielsen
@dfdan I’m actually not sure it’s possible. You might try modifying the search-ui template:
<invenio-search...
   search-extra-params=‘{"size":100"}'
...
  >
I thinkt the problem comes from here
Dan Granville
@dfdan
thanks @lnielsen - I'll try that / hack invenio-search-js if necessary.
Nicola
@ntarocco
@cs-ubr the deposit module is indeed something that we use in production, but it did not pass all the quality checks that we do when releasing a module as stable, so you might have such surprises (the config var not correctly set as default). For the indexing, I doubt it is related to fetching records (visiting the GUI), when you create there is @index decorator here so it should happen...
Peter Weber
@rerowep
:point_up: June 12, 2020 1:02 PM
I had the same idea and could not find anything to solve my problem. I hoped to find someone who has already found the solution.
ugswork
@ugswork
I need to provide links to some of the html pages in Docs directory, in the repository. The html files are in Docs/build/_html/. I have added a view function to return the html file. I am not sure if this is how it should be done. When I use the link, I see that the styles are not applied to the html page. I would like to know how to do this correctly. Thank you.
Lars Holm Nielsen
@lnielsen
@rerowep The only thing you have available is the ?next= redirect parameter to the login page which you could combine with an intermediary view
/login/?next=/login/redirect/ -> /login/redirect/ (has full access to current user etc), and can redirect to where needed
you’ll have two redirects which is not ideal, but will hardly be noticable for an end user
Peter Weber
@rerowep
@lnielsen Thanks for the hint, maybe we have to implement it like this.
Lars Holm Nielsen
@lnielsen

Proposal for new Invenio Governance

See inveniosoftware/opensource#60
Joseph G. Pawletko
@jgpawletko_gitlab
Hello Invenio folks, I'm working with the invenio-oauthclient code, specifically the ORCID functionality. I'm getting the redirect back from ORCID, but my Invenio test app doesn't respond. What is the best way to increase the log details (e.g., DEBUG mode) / debug an Invenio application? (Apologies for the n00b question!) Thank you for your time!
Miroslav Bauer
@mirekys
Hi folks, just asking before getting my hands dirty with implementation. Has anyone tried to implement some more complicated record/deposit approvement process that would require to define a record's lifecycle state in some sort of FSM? For Django, there is a very useful django-fsm library. We found an alternative for SQLAlchemy sqlalchemy-fsm, but were unable to integrate it into Invenio (it registers some listeners, that Invenio DB drops somewhere on startup). Now we are considering to hold record state as a plain metadata field and define state transitions as methods of our custom Record api class and protecting state from being modified outside of these methods. Would be very glad if there is already some more elegant solution :) Thanks
Lars Holm Nielsen
@lnielsen
@mirekys Yes, @ntarocco has some state management in Invenio-Circulation being used in InvenioILS for loan management
Nicola
@ntarocco
@mirekys we have implemented in collaboration with RERO a state matchine for book loans workflow, you can see it here: https://github.com/inveniosoftware/invenio-circulation/blob/master/invenio_circulation/config.py#L62 At that time, we have also evaluated pytransitions library, that looks nice. We gave it a try, but personally I prefer a more Object Oriented approach and in the end we decided to go on our own since the engine of it is quite simple, see here and here
Miroslav Bauer
@mirekys
Thanks a lot, @lnielsen @ntarocco ! That looks really nice and close to what we need, I would also prefer a more object oriented approach for an Invenio module, will definitely give it a try
Do you also have some protection in place against modifying the state field on loan record directly through a REST API, e.g. by sending a PATCH request?
Nicola
@ntarocco
Right now, we have implemented our own validator in ILS, not there: you can implement your own custom validation when validating the schema, see here. We did it like this to have validation both when using REST APIs but also going programmatically. Otherwise you might go for loaders/marshmallow validation.
Miroslav Bauer
@mirekys
Got it, thanks! :)
Joseph G. Pawletko
@jgpawletko_gitlab
a quick follow up re: the ORCID integration in invenio-oauthclient. The issues I was having were resolved by the latest commit to the main branch in GitHub (inveniosoftware/invenio-oauthclient@085cf70)
Zacharias Zacharodimos
@zzacharo
@jgpawletko_gitlab thanks to @jma we refactored the access_token_url passed to the orcid OAuth application. invenio-oauthclient==1.3.2 is already out! We will release backport releases i.e 1.1.4 and 1.2.2 for the invenio versions that are currently supported. Which version of invenio do you use?
Joseph G. Pawletko
@jgpawletko_gitlab
Hi @zzacharo , thank you for your message! We're developing a proof-of-concept application using v3.3. I will update my Pipfile to use invenio-oauthclient v1.3.2. Thanks again!
Otuoma Sanya
@otuoma

@zzacharo - started over with a clean environment. made it to the build assets step. ils webpack buildall ends with the following error:

Traceback (most recent call last):
  File "C:\Users\crawley\AppData\Local\Programs\Python\Python37\Scripts\ils-script.py", line 11, in <module>
    load_entry_point('invenio-app-ils', 'console_scripts', 'ils')()
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\flask\cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 1163, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\flask\cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "C:\Users\crawley\AppData\Roaming\Python\Python37\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\flask_webpackext\cli.py", line 72, in buildall
    current_webpack.project.buildall()
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\pywebpack\project.py", line 138, in buildall
    super(WebpackTemplateProject, self).buildall()
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\pywebpack\project.py", line 66, in buildall
    self.install()
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\pywebpack\project.py", line 51, in install
    return self.npmpkg.install(*args)
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\pynpm\package.py", line 76, in _run_npm
    **kwargs
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\site-packages\pynpm\utils.py", line 25, in run_npm
    cwd=pkgdir,
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "c:\users\crawley\appdata\local\programs\python\python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

In [virtual-env-path]/Lib/site-packages/pynpm/utils.py inside run_npm function, add shell=True so that you havesubprocess.call(command, cwd=pkgdir, shell=True )

Colin Sippl
@cs-ubr

Hi, I have a question related to invenio-deposit. Action "save" in the GUI (see default actions.html template) should create a PUT request. However, I'm always getting a POST request. The reason for this seems to be in function getEndpoints() in this line as the expression angular.isUndefined(vm.invenioRecordsEndpoints.self) is true :

...
  ...
    var deferred = $q.defer();
    if (angular.isUndefined(vm.invenioRecordsEndpoints.self)) {
      // Prepare the request
      var request = InvenioRecordsAPI.prepareRequest(
        vm.invenioRecordsEndpoints.initialization,
        'POST',
        {},
        vm.invenioRecordsArgs,
        vm.invenioRecordsEndpoints
      );
      // If the action url doesnt exists request it
      InvenioRecordsAPI.request(request)
        .then(function success(response) {
        // Upadate the endpoints
        $rootScope.$broadcast(
          'invenio.records.endpoints.updated', response.data.links
        );
        deferred.resolve({});
      }
      ...
    }
    ...

Consequently, the form data is not read out either. How do I fix this error?

Colin Sippl
@cs-ubr

Fixed the issue by adding links='{"self": "{{ config.DEPOSIT_RECORDS_API.format(pid_value=pid.pid_value) }}"} attribute to invenio-records directive inside my edit.html. I'm not sure if this is the right way, but it works.

However, now I'm getting a Missing required header argument. JWTInvalidHeaderError due to an authentication(?) problem. I already assigned deposit-admin-access to the admin role. In APP_DEFAULT_SECURE_HEADERS I have 'session_cookie_secure': True, 'session_cookie_http_only': True. Any hints?