EUDAT-B2NOTE / b2note

B2NOTE is a EUDAT pilot service allowing users to "annotate" semantically a document.
https://b2note.bsc.es
MIT License
4 stars 9 forks source link

Upgrade to Python 3 and Django 2 to fix security vulnerability issues #365

Closed TomasKulhanek closed 5 years ago

TomasKulhanek commented 5 years ago

Upgrade to Python and Django to fix security vulnerability issues

TomasKulhanek commented 5 years ago

Travis CI fails on

pymongo.errors.OperationFailure: Authentication failed.
The command "python manage.py test [secure]_app" exited with 1.

probably some discrepancy between created mongodb users and real connection

Local tests fails on

======================================================================
ERROR: test_create_annotation_db (b2note_app.tests.B2noteappTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/b2note/b2note_app/tests.py", line 228, in test_create_annotation_db
    a = self.create_annotation_db()
  File "/home/vagrant/b2note/b2note_app/tests.py", line 220, in create_annotation_db
    return Annotation.objects.create(jsonld_id=jsonld_id, type=type)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/query.py", line 422, in create
    obj.save(force_insert=True, using=self.db)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/base.py", line 741, in save
    force_update=force_update, update_fields=update_fields)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/base.py", line 779, in save_base
    force_update, using, update_fields,
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/base.py", line 870, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/base.py", line 908, in _do_insert
    using=using, raw=raw)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/query.py", line 1186, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1331, in execute_sql
    for sql, params in self.as_sql():
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1275, in as_sql
    for obj in self.query.objs
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1275, in <listcomp>
    for obj in self.query.objs
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1274, in <listcomp>
    [self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1215, in prepare_value
    value = field.get_db_prep_save(value, connection=self.connection)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/django/db/models/fields/__init__.py", line 789, in get_db_prep_save
    return self.get_db_prep_value(value, connection=connection, prepared=False)
  File "/home/vagrant/py3/lib64/python3.6/site-packages/djongo/models/fields.py", line 98, in get_db_prep_value
    f'Type {self.model} {self.name} Value: {value} must be of type list'
ValueError: Type <class 'b2note_app.models.Annotation'> jsonld_context Value: None must be of type list
TomasKulhanek commented 5 years ago

Major upgrade with updated/refactored code delivered