4810: NarWeb - name formats not aligned in general preferences and NarWeb option

svn: r17474
This commit is contained in:
Benny Malengier 2011-05-11 09:32:04 +00:00
parent 2cc6fa6dbc
commit 5d95f00489
2 changed files with 17 additions and 4 deletions

View File

@ -6424,7 +6424,14 @@ class NavWebOptions(MenuReportOptions):
# We must figure out the value of the first option before we can # We must figure out the value of the first option before we can
# create the EnumeratedListOption # create the EnumeratedListOption
fmt_list = _nd.get_name_format() fmt_list = _nd.get_name_format()
name_format = EnumeratedListOption(_("Name format"), fmt_list[0][0]) defaultnum = _nd.get_default_format()
default = 0
for ind,val in enumerate(fmt_list):
if val[0] == defaultnum:
default = ind
break
name_format = EnumeratedListOption(_("Name format"),
fmt_list[default][0])
for num, name, fmt_str, act in fmt_list: for num, name, fmt_str, act in fmt_list:
name_format.add_item(num, name) name_format.add_item(num, name)
name_format.set_help(_("Select the format to display names")) name_format.set_help(_("Select the format to display names"))

View File

@ -32,7 +32,6 @@ Web Calendar generator.
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# python modules # python modules
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from __future__ import print_function
from functools import partial from functools import partial
import os, codecs, shutil, re import os, codecs, shutil, re
import datetime, calendar import datetime, calendar
@ -1083,7 +1082,7 @@ class WebCalReport(Report):
else: else:
name = gen.lib.Name(primary_name) name = gen.lib.Name(primary_name)
surname_obj = name.get_primary_surname() surname_obj = name.get_primary_surname()
surname_obj.set_surname(maiden_name) surname_obj.set_surname(maiden_name)
else: else:
name = gen.lib.Name(primary_name) name = gen.lib.Name(primary_name)
name.set_display_as(self.name_format) name.set_display_as(self.name_format)
@ -1375,7 +1374,14 @@ class WebCalOptions(MenuReportOptions):
# We must figure out the value of the first option before we can # We must figure out the value of the first option before we can
# create the EnumeratedListOption # create the EnumeratedListOption
fmt_list = _nd.get_name_format() fmt_list = _nd.get_name_format()
name_format = EnumeratedListOption(_("Name format"), fmt_list[0][0]) defaultnum = _nd.get_default_format()
default = 0
for ind,val in enumerate(fmt_list):
if val[0] == defaultnum:
default = ind
break
name_format = EnumeratedListOption(_("Name format"),
fmt_list[default][0])
for num, name, fmt_str, act in fmt_list: for num, name, fmt_str, act in fmt_list:
name_format.add_item(num, name) name_format.add_item(num, name)
name_format.set_help(_("Select the format to display names")) name_format.set_help(_("Select the format to display names"))