These are chat archives for inveniosoftware/invenio

15th
Aug 2017
Ioannis Tsanaktsidis
@ioannistsanaktsidis
Aug 15 2017 09:01
@diegodelemos indeed the problem is with angular-csp
Lars Holm Nielsen
@lnielsen
Aug 15 2017 09:25

@ioannistsanaktsidis You can disable CSP with the following in your config.py:

from invenio_app.config import APP_DEFAULT_SECURE_HEADERS
APP_DEFAULT_SECURE_HEADERS['content_security_policy'] = {}

Note that, CSP in general offers a good protection against Cross-Site Scripting attacks on your site so instead of disabling it, you can adjust the CSP instead to suite your needs. See https://github.com/GoogleCloudPlatform/flask-talisman#content-security-policy and https://github.com/inveniosoftware/invenio-app/blob/master/invenio_app/config.py#L66-L83

Ioannis Tsanaktsidis
@ioannistsanaktsidis
Aug 15 2017 09:30
ok cool, thanks a lot
:)
Zacharias Zacharodimos
@zzacharo
Aug 15 2017 12:09
@lnielsen I started using invenio-records_files.api.Record for introducing files in our records in inspire, but I have a case that our tests are failing because when we force delete here https://github.com/inveniosoftware/invenio-records-files/blob/master/invenio_records_files/api.py#L320 it is asumed that a file is attached in the record otherwise the delete on RecordBuckets will fail. Am I missing something? I don't think that an invenio_records.Record is obligated to have some files attached. Is there a workaround for this or it misses a check if the RecordBucket exists?
Lars Holm Nielsen
@lnielsen
Aug 15 2017 14:56

Updated DevForum schedule

https://indico.cern.ch/category/6046/ (upcoming trainings in September related to data modelling, search and indexing)
@zzacharo You mean these lines are failing if there’s no bucket?
If so, then likely it should be possible to execute a delete query without failing so probably a simple fix to get it to work.
Zacharias Zacharodimos
@zzacharo
Aug 15 2017 15:02
yep these lines I mean
I am trying with just check the result of the query if exists
Lars Holm Nielsen
@lnielsen
Aug 15 2017 15:02
Can you send an exception\
Zacharias Zacharodimos
@zzacharo
Aug 15 2017 15:02
        if force:
            record_bucket = RecordsBuckets.query.filter_by(
                record=self.model,
                bucket=self.files.bucket
            ).one_or_none()
            if record_bucket:
                record_bucket.delete()
Lars Holm Nielsen
@lnielsen
Aug 15 2017 15:03
that will execute two queries when only one DELETE is really needed….not sure I understand why i fails….it shoudl be able to execute a delete which doesn’t delete anything…..
and doesn’t throw an exception
Zacharias Zacharodimos
@zzacharo
Aug 15 2017 15:06
I am gonna check it again and be sure that this is the case because I see another error also...