Friday, April 14, 2017

Government lock-in by Microsoft is alarming

Why did I delete my Facebook account? Why do I refuse to invest my time and that of my employees into proprietary knowledge? Because I believe that the situation is alarming. If you don’t believe me, then read Adrian Offerman’s article on JoinUp where he reports that journalists from Investigate Europe interviewed many competent people and conclude that the dependence on Microsoft:

  • causes costs to rise continuously, and blocks technical progress in government organisations;

  • systematically undermines European procurement and competition laws;

  • gives Microsoft overwhelming political influence, culminating in personal interdependence as well as penetration of schools and universities; and

  • puts government IT systems, together with their citizens’ personal information, at high risk both technologically and politically.

Checkin

I checked in my yesterday’s work for #1765 (Calendar entries are now ChangeObservable).

I fixed a bug in lino_xl.lib.votes.models which was probably introduced by Tonis. For example in the following line:

states[o.state].append(
    ar.obj2html(o, o.user.initials or str(o.user), title=o.state))

The problem is that you use the str() (which is necessary), but you forgot to import from builtins import str (which we need for Python 2to3 compatibility).

I released this to Jane because it was disturbing.

I noticed that the xl repository on Jane had local commits:

$ git diff origin/master
diff --git a/lino_xl/lib/tickets/models.py b/lino_xl/lib/tickets/models.py
index 513cd1e..c3bf9d7 100644
--- a/lino_xl/lib/tickets/models.py
+++ b/lino_xl/lib/tickets/models.py
@@ -555,7 +555,7 @@ class Ticket(UserAuthored, mixins.CreatedModified,

         """
         if self.user:
-            yield self.user
+            yield self.user.get_as_user()
         if issubclass(
                 settings.SITE.user_model,
                 dd.plugins.faculties.end_user_model):
diff --git a/lino_xl/lib/votes/mixins.py b/lino_xl/lib/votes/mixins.py
index 0bcd10f..7dc382d 100644
--- a/lino_xl/lib/votes/mixins.py
+++ b/lino_xl/lib/votes/mixins.py
@@ -75,8 +75,8 @@ vote exists.
         self.set_auto_vote(comment.user, VoteStates.invited)

     def set_auto_vote(self, user, state):
-        # dd.logger.info("20170406 set_auto_vote %s %s", user, state)
         vote = self.get_favourite(user)
+        dd.logger.info("20170406 set_auto_vote %s %s, current_vote |%s|", user, state, vote)
         if vote is None:
             create_row(
                 rt.models.votes.Vote, user=user,
@@ -86,5 +86,7 @@ vote exists.
         """Automatically call :meth:`set_author_votes` after saving.

         """
+        dd.logger.info("20170406 Pre-super")
         super(Votable, self).after_ui_save(ar, cw)
+        dd.logger.info("20170406 Post-super")
         self.set_author_votes()

I think we can throw them away. I guess that Tonis has been debugging. I did:

$ git checkout origin/master
Note: checking out 'origin/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 86f1afc... fixing #1757

Pointing to a database object

I reviewed Tonis’ work for #1739. Bravo, Tonis! You used the following expression:

o.obj2href(ar, text=getattr(o.wish_type,'text', _("Wish"))

I optimized the signature of the lino.core.model.Model.obj2href() method and added usage examples in Pointing to a database object so that you should now be able to write:

o.obj2href(ar, str(o.wish_type or _("Wish")))

Note that lino.core.model.Model.obj2href() does not not return a “tuple (text, attributes)” but an etree html element.

Tx25 fails since 20170317

Investigating for #1706. Yes, the logging is now more detailed:

[2017-04-14 11:43:38.909691] Traceback (most recent call last):
  File "/env/repositories/welfare/lino_welfare/modlib/cbss/mixins.py", line 248, in execute_request
    retval = self.execute_request_(now, simulate_response)
  File "/env/repositories/welfare/lino_welfare/modlib/cbss/mixins.py", line 553, in execute_request_
    return self.execute_newstyle(client, info, simulate_response)
  File "/env/repositories/welfare/lino_welfare/modlib/cbss/models.py", line 530, in execute_newstyle
    reply = client.service.retrieveTI(infoCustomer, None, si)
  File "/env/lib/python2.7/site-packages/suds/client.py", line 542, in __call__
    return client.invoke(args, kwargs)
  File "/env/lib/python2.7/site-packages/suds/client.py", line 602, in invoke
    result = self.send(soapenv)
  File "/env/lib/python2.7/site-packages/suds/client.py", line 637, in send
    reply = transport.send(request)
  File "/env/lib/python2.7/site-packages/suds/transport/http.py", line 177, in send
    return HttpTransport.send(self, request)
  File "/env/lib/python2.7/site-packages/suds/transport/http.py", line 77, in send
    fp = self.u2open(u2request)
  File "/env/lib/python2.7/site-packages/suds/transport/http.py", line 118, in u2open
    return url.open(u2request, timeout=tm)
  File "/usr/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>

It seems that the URL is stored in the lino_welfare/modlib/cbss/WSDL/RetrieveTIGroups.wsdl.