20111114

Choice Lists

Choice Lists had a design flaw: they used babel.BabelText instances to store the items, but it is better to use simple translatable strings (gettext_lazy) and Django’s translation machine. All currently existing choicelists have been converted:

  • lino.apps.dsbe.models.CefLevel
  • lino.modlib.mails.utils.DurationUnit
  • lino.modlib.cal.utils.DurationUnit
  • lino.utils.choicelists.HowWell
  • lino.utils.choicelists.HowMuch

Data fields sex renamed to gender

The new choicelist lino.utils.choicelists.Gender is now being used to create the gender fields in lino.apps.dsbe.models.Person and lino.apps.dsbe.models.PersonSearch. Unit test cases and fixtures have been adapted. One advantage is that Lino no longer accepts a simple ‘M’ as valid value on a gender field. User code must import the Gender choicelist and use the “constants” defined there.

Calendar statuses now configurable

The following new models replace the formerly used choice list of same name. It became clear from recent user interviews that these lists cannot be hard-coded.

  • lino.modlib.cal.models.TaskStatus
  • lino.modlib.cal.models.EventStatus
  • lino.modlib.cal.models.AccessClass
  • lino.modlib.cal.models.Priority

The previously hard-coded values are now in a new fixture lino.modlib.cal.fixtures.std

Note: What is the plural of “Status”? Answer: “Statuses”. At least in English. But in German the official plural form is “Status”, written like the singular form and pronounced with a long “u”. That’s why I’m going to translate “Status” by “Zustand” which has a better plural form.

BCSS connection

Worked on lino.modlib.bcss.models to explore the BCSS functionality:

There were two problems in IdentifyPersonRequest.build_service():

  • a simple bug: if national_id known, it filled both LastName and FirstName with the person’s last_name.
  • if national_id and birth_date empty, the reply said “An error occurred during the parsing of the request body. Please check your message format.” and “Uncompleted content model. expecting: <BirthDate>,<MiddleName>”. Seems that in the MiddleName element in PhoneticSearch must be present even if it is empty. These are probably the kind of things which generateDS would detect already when generating the XML.

More changes:

  • enhanced RequestStatus.execute_request()
  • new field BCSSRequest.status
  • new choicelist RequestStatus
  • new utility functions lino.utils.bcss.reply2lines() and lino.utils.bcss.xml2reply()

Check-in 20111114b at 23:41, time to go to bed. TODO:

http://127.0.0.1:8000/api/contacts/Persons/117?query=&an=detail&tab=11
  • non-editable fields are not shown in a grid
  • console message about disabled_actions doesn’t appear