===================================
20141208 (Monday, 08 December 2014)
===================================
Delete generic related objects when deleting an object
======================================================
I worked on :ticket:`30` and closed it.
:mod:`lino.projects.min2.tests.test_min2` is the basic test case which
demonstrates the new feature.
Another confirmation is that
`lino_welfare.projects.eupen.tests.test_watch_tim` failed: it said
"ValidationError: [u'Kann Müller Max Moritz (5088) nicht löschen weil
1 Änderungen darauf verweisen.']". I had to define an
:attr:`allow_cascaded_delete
` on
:class:`ml.changes.Change` as `['master', 'object']`. Yes, when we
delete a database object, we indeed automatically want to forget any
change records related to this object. Anyway these change records
would have a stale owner. (TODO: Except when we want to keep track of
the fact that some object has been deleted. For example in Eupen it
happened that we wanted to that a given partner id had been used for a
given time. Added new :ticket:`32`.
Run subprocesses on Windows
===========================
Taavi reported the following problem on a Windows computer::
FAIL: test_jsgen (tests.UtilsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\mypy\repositories\lino\tests\__init__.py", line 146, in test_jsgen
def test_jsgen(self): self.run_simple_doctests('lino/utils/jsgen.py')
File "c:\mypy\repositories\atelier\atelier\test.py", line 70, in run_simple_doctests
self.run_subprocess(args, **kw)
File "c:\mypy\repositories\atelier\atelier\test.py", line 54, in run_subprocess
self.fail(msg)
AssertionError: C:\Python27\python.exe -m atelier.doctest_utf8 lino/utils/jsgen.py ({}) returned 1:
-----
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:\mypy\repositories\atelier\atelier\doctest_utf8.py", line 16, in
import doctest
File "C:\Python27\lib\doctest.py", line 99, in
import unittest, difflib, pdb, tempfile
File "C:\Python27\lib\tempfile.py", line 35, in
from random import Random as _Random
File "C:\Python27\lib\random.py", line 885, in
_inst = Random()
File "C:\Python27\lib\random.py", line 97, in __init__
self.seed(x)
File "C:\Python27\lib\random.py", line 113, in seed
a = long(_hexlify(_urandom(2500)), 16)
WindowsError: [Error -2146893818] Invalid Signature
`Tim Golden
`_
helped me to undestand that this was because on Windows some system
environment variables are needed when you ask for a temporary file
name.
To solve this, I changed
:meth:`atelier.utils.SubProcessParent.build_environment`
method so that it is filled from `os.environ`.
Developing on Windows? No thanks!
=================================
After two hours of fiddling we still didn't get the test suite to pass
on Taavi's Windows machine. The last thing before we stopped was a
test failure in :mod:`lino.utils.html2xhtml`. I am afraid that this
is due to the fact that the developers of HtmlTidy don't seem to care
very much about a Windows binary version.
See
`PyTidyLib `__
and
`HtmlTidy `__.
The easiest solution to all these problems is that Taavi moves from
Windows to Linux.