Monday, December 29, 2014¶
Welcome to new team member Mahmoud from Egypt¶
I think it is time to present our new team member Mahmoud who agreed to assist me at least for a few months. And of course we hope that this is just the beginning of a long releationship. Mahmoud is my “assistant”. He will help me to develop and maintain Lino. In a first phase he must still learn. While teaching him, I will build reusable documentation for future team members. The long-term goal is that he works independently on tasks which we assign to him after consultation.
Merged lino.ui into lino.core¶
I merged the content of the lino.ui package into lino.core
,
because this differentiation was historical and irritating.
File renames:
mv ui/elems.py core/ mv ui/store.py core/ mv ui/urls.py core/ mv ui/render.py core/renderer.py rm ui/ui.py rm ui/base.py
Moved class lino.ui.base.Handle to
lino.core.utils.Handle
.
Calendar¶
There was a problem for generating the calendar view of a
blogger_year
: the cell for today (December 29, 2014) was
not clickable although a blog entry existed. I think it is because
today we are already in week 1 of 2015. It is possible that we will
know more in three days…
AttributeError ‘module’ object has no attribute ‘ContentType’¶
File lino/modlib/courses/models.py in events_by_course, line 444
This was a simple typo bug which occurred in Renamed “Lino Faggio” to “Lino Voga”. Fixed.
TODO: write test case which would have detected it.
‘NoneType’ object has no attribute ‘get_view_permission’¶
The above error message came when editing or displaying objects in a
table without detail_layout
. Fixed.
Optimization en passant: The <head> block of Lino’s html contained many empty lines, which made it difficult to read for humans. Fixed.
Problems with mod_wsgi in daemon mode¶
Wow. I had a few hours of stress after an upgrade of the production server in CPAS de Châtelet.
TypeError: H is undefined
in the JavaScript console in CPAS de Châtelet after upgrading. And this caused the detail window for clients to not open but to produce another JavaScript errorTypeError: Lino.pcsw.Clients.detail is undefined
.AssertionError at /
andNo exception message supplied
, and the system.log showing:File "/usr/local/repositories/lino/lino/modlib/extjs/ext_renderer.py", line 748, in write_lino_js assert profile == jsgen._for_user_profile AssertionError
or:
Exception: <ParamsPanel main in ParamsLayout on newcomers.AvailableCoaches> of LayoutHandle for ParamsLayout on newcomers.AvailableCoaches has no variables
All these diverse phenomens had a single cause: a wrong configuration of mod_wsgi.
Some print
statements in the wsgi.py
file were useful for
diagnosing the problem:
print sys.path
import mod_wsgi
print mod_wsgi.version
from lino import hello
The mod_wsgi.version on this server is (3, 3).
To see this more easily in the future, I added mod_wsgi to the items
reported by get_used_libs
.
The output of aptitude confirmed the mod_wsgi version:
$ aptitude show libapache2-mod-wsgi
Package: libapache2-mod-wsgi
State: installed
Automatically installed: no
Version: 3.3-4+deb7u1
Priority: optional
...
The guilty was that the different threads got activated using different version of Python, Django and Lino.
The Django docs say:
“Daemon mode” is the recommended mode for running mod_wsgi (…) in daemon mode you can’t use WSGIPythonPath; instead you should use the python-path option to WSGIDaemonProcess.
This led me to try this option to WSGIDaemonProcess:
WSGIDaemonProcess lino_prod threads=15 python-path=/var/www/vhosts/prod/env/local/lib/python2.7/site-packages
And it solved all problems.
Until today the following trick in the djangosite_local.py
had worked well:
site.addsitedir(join(home_dir, "env/local/lib/python2.7/site-packages"))
I ignore the details, but I guess that it stopped to work after some update.
Note that I still recommend to create your virtualenvs in an independent system-wide place (e.g. /usr/local/virtualenvs) and then, in your project directories, make a symbolic link called “env” which points to one of these virtualenvs.