# - - - u p d a t e A b b r s
def updateAbbrs(c, txny):
'''Replace outdated bird codes with exact equivalents if available
[ (c is a pycbc.Census instance) and
(txny is an xnomo3.Txny instance) ->
return a pycbc.Census instance representing c, but with
any bird codes replaced by exact equivalents from txny if there
are any ]
'''
For the logic that replaces outdated codes, see hist-oldCode.
#-- 1
# [ if c.rel is abbrMod.REL_SIMPLE ->
# if c.form has an exact equivalent in txny ->
# return a new pycbc.Census instance representing c but with
# c.form replaced by that equivalent
# else -> return c
# else if either c.form or c.alt_form has an exact equivalent
# in txny ->
# return a new pycbc.Census with those fields replaced with
# those equivalents
# else -> return c ]
if c.rel.strip() == '':
return updateSimpleAbbrs(c, txny)
else:
return updateCompoundAbbrs(c, txny)
In the Postgresql version, the test above was:
if c.rel == abbrMod.REL_SIMPLE:
However, since abbrMod.REL_SIMPLE is one
space, the MySQL version of the database returns an
empty string, hence the more general test above which
works correctly with either an empty string or a single
space.