========================= Tuesday, January 13, 2015 ========================= Moved the content of :lino:`/dev/mixins` to the docstrings in :mod:`lino.core.model` and :mod:`lino.mixins`. Fixed :ticket:`7`. When a new user had been created through the web interface, it was not possible to change their password. ValueError: Attempted relative import in non-package ---------------------------------------------------- Then I converted the content of `/dev/ml/users` to the :mod:`lino.modlib.users` API. Since this is a tested document, I changed two lines in :srcref:`/tests/__init__.py`. Basically I replaced:: self.run_simple_doctests("docs/dev/ml/users.rst") with:: self.run_simple_doctests("lino/modlib/users/models.py") This change caused a :message:`ValueError: Attempted relative import in non-package` at the line:: from .mixins import UserProfiles I've had this problem before, and this time I explored the reason for it. It comes from :mod:`atelier.doctest_utf8` where some code which I did not write (I copied it from Python 2.7's ``doctest`` module) does a special handling if a file ends with :file:`.py`. And a comment for this treatment says:: # It is a module -- insert its dir into sys.path and try to # import it. If it is part of a package, that possibly # won't work because of package imports. And this comment is still there in the doctest module of Python 3. And of course I am not the first to stumble over this problem. See `Doctest and relative imports `_ where Jason Scheirer advises: I would get rid of the relative imports, many Python style guides strongly discourage them, most forbid them. But even when I do this, the import fails because Django is special: you cannot import a :xfile:`models.py` module if your `DJANGO_SETTINGS_MODULE` is not set. So I moved these tests to a separate new document :lino:`/dev/users`. A topic which anyway has serious lacks of documentation.