Wednesday, February 25, 2015

Learning from yesterday

I solved #107, at least theoretically. To be tested on the field by #108.

A ticket for Mahmoud

Created new #109 and assigned it to Mahmoud.

Miscellaneous

Created new #110. This is waiting for confirmation from Chatelet.

Final sprint in Eupen

Recorded and fixed a subtle new ticket #111.

  • First of all there was a translation problem: “Ausgestellte Bescheinigungen” –> “Ausgestellte Bestätigungen”
  • The problem was in lino.modlib.excerpts.models.post_init_excerpt() when setting the default language of a new excerpt. I had been thinking that the recipient overrides the owner, but as it turns out it is the opposite: the owner overrides the recipient. This rule is important when they specify both a recipient and a language on the Confirmation.

setup() got an unexpected keyword argument ‘known_values’

Created new #112 and fixed it. Here is the exception:

WARNING AjaxExceptionResponse:
TypeError
setup() got an unexpected keyword argument 'known_values'

TRACEBACK:
  File "/home/luc/pythonenvs/py27/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/luc/pythonenvs/py27/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/luc/pythonenvs/py27/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/luc/hgwork/lino/lino/modlib/extjs/views.py", line 208, in get
    return settings.SITE.kernel.run_callback(request, thread_id, button_id)
  File "/home/luc/hgwork/lino/lino/core/kernel.py", line 507, in run_callback
    c.func(ar)
  File "/home/luc/hgwork/lino/lino/modlib/beid/mixins.py", line 370, in yes
    return self.goto_client_response(ar2, obj, msg)
  File "/home/luc/hgwork/lino/lino/modlib/beid/mixins.py", line 297, in goto_client_response
    ar.goto_instance(obj)
  File "/home/luc/hgwork/lino/lino/core/requests.py", line 886, in goto_instance
    self.set_response(data_record=self.elem2rec_detailed(obj))
  File "/home/luc/hgwork/lino/lino/core/requests.py", line 695, in elem2rec_detailed
    rec = ar.elem2rec1(rh, elem, **rec)
  File "/home/luc/hgwork/lino/lino/core/requests.py", line 666, in elem2rec1
    rec.update(data=rh.store.row2dict(ar, elem))
  File "/home/luc/hgwork/lino/lino/core/store.py", line 1166, in row2dict
    v = fld.full_value_from_object(row, ar)
  File "/home/luc/hgwork/lino/lino/core/store.py", line 337, in full_value_from_object
    return self.vf.value_from_object(obj, ar)
  File "/home/luc/hgwork/lino/lino/core/fields.py", line 435, in value_from_object
    return m(obj, ar)
  File "/home/luc/hgwork/lino/lino/modlib/uploads/choicelists.py", line 100, in f
    known_values=dict(type=utype))
  File "/home/luc/hgwork/lino/lino/core/requests.py", line 267, in spawn_request
    return self.__class__(**kw)
  File "/home/luc/hgwork/lino/lino/core/requests.py", line 186, in __init__
    self.setup(**kw)

[25/Feb/2015 14:00:13] "GET /callbacks/-1064089634/yes?_dc=1424865612749 HTTP/1.1" 500 2183

The problem was in lino.core.kernel.Kernel.run_callback() who created the callback request always as an instance of ActorRequest. But most requests are instances of TableRequest instances. We must take care to create the right class.

Left for a future occasion: Why did lino_welfare.projects.std.tests.test_beid not find this bug? Write a test case which would have detected the problem.

Applets using “resources from the remote locations”

When I go to a Lino site with DavLink and The EIDReader applet, I currently always need to manually confirm two exceptions:

The application [DavLink|EIDReader] from http://127.0.0.1:8000/ uses resources from the following remote locations:

Are you sure you want to run this application?

Tutorials and the test suite

I noted that The Lino Polls tutorial is part of the test suite, but it is not a demo project (see demo_projects). This means that running the Lino test suite does currently not create a persitent cached demo database and a media/cache of that project. To get that, we would need to move the Python code from /docs to /lino (i.e. to somewhere under lino.projects). That’s needed when running the test suite on Travis. This move would require substantial changes in the text. But it would have another advantage: we would be able to write more than one tested document about the same demo project.