|
Lines 140-149
Link Here
|
| 140 |
common_udm_options.extend(["--set", "ucsversionend=%s" % (options.ucsversionend,),]) |
140 |
common_udm_options.extend(["--set", "ucsversionend=%s" % (options.ucsversionend,),]) |
| 141 |
|
141 |
|
| 142 |
if self.udm_module_name == "settings/udm_module": |
142 |
if self.udm_module_name == "settings/udm_module": |
| 143 |
for messagecatalog in options.messagecatalog: |
143 |
for udm_module_messagecatalog in options.udm_module_messagecatalog: |
| 144 |
filename_parts = os.path.splitext(os.path.basename(messagecatalog)) |
144 |
filename_parts = os.path.splitext(os.path.basename(udm_module_messagecatalog)) |
| 145 |
language = filename_parts[0] |
145 |
language = filename_parts[0] |
| 146 |
with open(messagecatalog, 'r') as f: |
146 |
with open(udm_module_messagecatalog, 'r') as f: |
| 147 |
common_udm_options.extend(["--append", "messagecatalog=%s %s" % (language, base64.b64encode(f.read()),),]) |
147 |
common_udm_options.extend(["--append", "messagecatalog=%s %s" % (language, base64.b64encode(f.read()),),]) |
| 148 |
if options.umcregistration: |
148 |
if options.umcregistration: |
| 149 |
try: |
149 |
try: |
|
Lines 157-162
Link Here
|
| 157 |
with open(icon, 'r') as f: |
157 |
with open(icon, 'r') as f: |
| 158 |
common_udm_options.extend(["--append", "icon=%s" % (base64.b64encode(f.read()),),]) |
158 |
common_udm_options.extend(["--append", "icon=%s" % (base64.b64encode(f.read()),),]) |
| 159 |
|
159 |
|
|
|
160 |
if self.udm_module_name == "settings/udm_syntax": |
| 161 |
for udm_syntax_messagecatalog in options.udm_syntax_messagecatalog: |
| 162 |
filename_parts = os.path.splitext(os.path.basename(udm_syntax_messagecatalog)) |
| 163 |
language = filename_parts[0] |
| 164 |
with open(udm_syntax_messagecatalog, 'r') as f: |
| 165 |
common_udm_options.extend(["--append", "messagecatalog=%s %s" % (language, base64.b64encode(f.read()),),]) |
| 166 |
|
| 167 |
if self.udm_module_name == "settings/udm_hook": |
| 168 |
for udm_hook_messagecatalog in options.udm_hook_messagecatalog: |
| 169 |
filename_parts = os.path.splitext(os.path.basename(udm_hook_messagecatalog)) |
| 170 |
language = filename_parts[0] |
| 171 |
with open(udm_hook_messagecatalog, 'r') as f: |
| 172 |
common_udm_options.extend(["--append", "messagecatalog=%s %s" % (language, base64.b64encode(f.read()),),]) |
| 173 |
|
| 160 |
rc, self.object_dn, stdout = self.udm_find_object_dn() |
174 |
rc, self.object_dn, stdout = self.udm_find_object_dn() |
| 161 |
if not self.object_dn: |
175 |
if not self.object_dn: |
| 162 |
|
176 |
|
|
Lines 858-863
Link Here
|
| 858 |
check_udm_module_options(option, opt_str, value, parser) |
872 |
check_udm_module_options(option, opt_str, value, parser) |
| 859 |
parser.values.ensure_value(option.dest, []).append(value) |
873 |
parser.values.ensure_value(option.dest, []).append(value) |
| 860 |
|
874 |
|
|
|
875 |
def check_udm_syntax_options(option, opt_str, value, parser): |
| 876 |
if value.startswith('--'): |
| 877 |
raise OptionValueError("%s requires an argument" % (opt_str,)) |
| 878 |
if not parser.values.udm_syntax: |
| 879 |
raise OptionValueError("%s can only be used after --udm_syntax" % (opt_str,)) |
| 880 |
|
| 881 |
def option_callback_append_udm_syntax_options(option, opt_str, value, parser): |
| 882 |
check_udm_syntax_options(option, opt_str, value, parser) |
| 883 |
parser.values.ensure_value(option.dest, []).append(value) |
| 884 |
|
| 885 |
def check_udm_hook_options(option, opt_str, value, parser): |
| 886 |
if value.startswith('--'): |
| 887 |
raise OptionValueError("%s requires an argument" % (opt_str,)) |
| 888 |
if not parser.values.udm_hook: |
| 889 |
raise OptionValueError("%s can only be used after --udm_hook" % (opt_str,)) |
| 890 |
|
| 891 |
def option_callback_append_udm_hook_options(option, opt_str, value, parser): |
| 892 |
check_udm_hook_options(option, opt_str, value, parser) |
| 893 |
parser.values.ensure_value(option.dest, []).append(value) |
| 894 |
|
| 861 |
def ucs_registerLDAPExtension(): |
895 |
def ucs_registerLDAPExtension(): |
| 862 |
functionname = inspect.stack()[0][3] |
896 |
functionname = inspect.stack()[0][3] |
| 863 |
parser = OptionParser(prog=functionname, option_class=UCSOption) |
897 |
parser = OptionParser(prog=functionname, option_class=UCSOption) |
|
Lines 895-904
Link Here
|
| 895 |
help="End activation with UCS version", metavar="<UCS Version>") |
929 |
help="End activation with UCS version", metavar="<UCS Version>") |
| 896 |
|
930 |
|
| 897 |
udm_module_options = OptionGroup(parser, "UDM module specific options") |
931 |
udm_module_options = OptionGroup(parser, "UDM module specific options") |
| 898 |
udm_module_options.add_option("--messagecatalog", dest="messagecatalog", |
932 |
udm_module_options.add_option("--messagecatalog", dest="udm_module_messagecatalog", |
| 899 |
type="existing_filename", default=[], |
933 |
type="existing_filename", default=[], |
| 900 |
action="callback", callback=option_callback_append_udm_module_options, |
934 |
action="callback", callback=option_callback_append_udm_module_options, |
| 901 |
help="Gettext mo file", metavar="<GNU message catalog file>") |
935 |
help="Gettext mo file", metavar="<GNU message catalog file>") |
|
|
936 |
udm_module_options.add_option("--udm_module_messagecatalog", dest="udm_module_messagecatalog", |
| 937 |
type="existing_filename", default=[], |
| 938 |
action="callback", callback=option_callback_append_udm_module_options, |
| 939 |
help="Gettext mo file", metavar="<GNU message catalog file>") |
| 902 |
udm_module_options.add_option("--umcregistration", dest="umcregistration", |
940 |
udm_module_options.add_option("--umcregistration", dest="umcregistration", |
| 903 |
type="existing_filename", |
941 |
type="existing_filename", |
| 904 |
action="callback", callback=option_callback_set_udm_module_options, |
942 |
action="callback", callback=option_callback_set_udm_module_options, |
|
Lines 909-915
Link Here
|
| 909 |
help="UDM module icon", metavar="<Icon file>") |
947 |
help="UDM module icon", metavar="<Icon file>") |
| 910 |
parser.add_option_group(udm_module_options) |
948 |
parser.add_option_group(udm_module_options) |
| 911 |
|
949 |
|
|
|
950 |
udm_module_options = OptionGroup(parser, "UDM syntax specific options") |
| 951 |
udm_module_options.add_option("--udm_syntax_messagecatalog", dest="udm_syntax_messagecatalog", |
| 952 |
type="existing_filename", default=[], |
| 953 |
action="callback", callback=option_callback_append_udm_syntax_options, |
| 954 |
help="Gettext mo file", metavar="<GNU message catalog file>") |
| 955 |
parser.add_option_group(udm_module_options) |
| 912 |
|
956 |
|
|
|
957 |
udm_module_options = OptionGroup(parser, "UDM hook specific options") |
| 958 |
udm_module_options.add_option("--udm_hook_messagecatalog", dest="udm_hook_messagecatalog", |
| 959 |
type="existing_filename", default=[], |
| 960 |
action="callback", callback=option_callback_append_udm_hook_options, |
| 961 |
help="Gettext mo file", metavar="<GNU message catalog file>") |
| 962 |
parser.add_option_group(udm_module_options) |
| 963 |
|
| 913 |
# parser.add_option("-v", "--verbose", action="count") |
964 |
# parser.add_option("-v", "--verbose", action="count") |
| 914 |
|
965 |
|
| 915 |
udm_passthrough_options = [] |
966 |
udm_passthrough_options = [] |