|
137 |
try: |
137 |
try: |
138 |
if not install_python_file(objectclass, target_subdir, new_relative_filename, new_object_data): |
138 |
if not install_python_file(objectclass, target_subdir, new_relative_filename, new_object_data): |
139 |
return |
139 |
return |
|
|
140 |
install_messagecatalog(dn, new, objectclass) |
140 |
if objectclass == 'univentionUDMModule': |
141 |
if objectclass == 'univentionUDMModule': |
141 |
install_messagecatalog(dn, new) |
|
|
142 |
install_umcregistration(dn, new) |
142 |
install_umcregistration(dn, new) |
143 |
install_umcicons(dn, new) |
143 |
install_umcicons(dn, new) |
144 |
finally: |
144 |
finally: |
|
151 |
listener.setuid(0) |
151 |
listener.setuid(0) |
152 |
try: |
152 |
try: |
153 |
remove_python_file(objectclass, target_subdir, old_relative_filename) |
153 |
remove_python_file(objectclass, target_subdir, old_relative_filename) |
|
|
154 |
remove_messagecatalog(dn, old, univentionUDMSyntax) |
154 |
if objectclass == 'univentionUDMModule': |
155 |
if objectclass == 'univentionUDMModule': |
155 |
remove_umcicons(dn, old) |
156 |
remove_umcicons(dn, old) |
156 |
remove_umcregistration(dn, old) |
157 |
remove_umcregistration(dn, old) |
157 |
remove_messagecatalog(dn, old) |
|
|
158 |
finally: |
158 |
finally: |
159 |
listener.unsetuid() |
159 |
listener.unsetuid() |
160 |
|
160 |
|
|
475 |
if parent_dir: |
475 |
if parent_dir: |
476 |
cleanup_python_moduledir(python_basedir, target_subdir, parent_dir) |
476 |
cleanup_python_moduledir(python_basedir, target_subdir, parent_dir) |
477 |
|
477 |
|
478 |
def install_messagecatalog(dn, attrs): |
478 |
def install_messagecatalog(dn, attrs, objectclass): |
479 |
translationfile_ldap_attribute = "univentionMessageCatalog" |
479 |
translationfile_ldap_attribute = "univentionMessageCatalog" |
480 |
translationfile_ldap_attribute_and_tag_prefix = "%s;entry-lang-" % (translationfile_ldap_attribute,) |
480 |
translationfile_ldap_attribute_and_tag_prefix = "%s;entry-lang-" % (translationfile_ldap_attribute,) |
|
|
481 |
if objectclass == 'univentionUDMModule': |
482 |
prefix = "univention-admin-handlers" |
483 |
elif objectclass == 'univentionUDMSyntax': |
484 |
prefix = "univention-admin-syntax" |
485 |
elif objectclass == 'univentionUDMHook': |
486 |
prefix = "univention-admin-hooks" |
481 |
|
487 |
|
482 |
values = {} |
488 |
values = {} |
483 |
for ldap_attribute in attrs.keys(): |
489 |
for ldap_attribute in attrs.keys(): |
|
490 |
module_name = attrs.get('cn')[0] |
496 |
module_name = attrs.get('cn')[0] |
491 |
for language_tag, mo_data_binary in values.items(): |
497 |
for language_tag, mo_data_binary in values.items(): |
492 |
targetdir = os.path.join(LOCALE_BASEDIR, language_tag, 'LC_MESSAGES') |
498 |
targetdir = os.path.join(LOCALE_BASEDIR, language_tag, 'LC_MESSAGES') |
493 |
filename = os.path.join(targetdir, "univention-admin-handlers-%s.mo" % (module_name.replace('/', '-'),) ) |
499 |
filename = os.path.join(targetdir, "%s-%s.mo" % (prefix, module_name.replace('/', '-'),) ) |
494 |
if not os.path.exists(targetdir): |
500 |
if not os.path.exists(targetdir): |
495 |
ud.debug(ud.LISTENER, ud.ERROR, '%s: Error writing %s. Parent directory does not exist.' % (name, filename)) |
501 |
ud.debug(ud.LISTENER, ud.ERROR, '%s: Error writing %s. Parent directory does not exist.' % (name, filename)) |
496 |
continue |
502 |
continue |
|
497 |
with open(filename, 'w') as f: |
503 |
with open(filename, 'w') as f: |
498 |
f.write(mo_data_binary) |
504 |
f.write(mo_data_binary) |
499 |
|
505 |
|
500 |
def remove_messagecatalog(dn, attrs): |
506 |
def remove_messagecatalog(dn, attrs, objectclass): |
501 |
translationfile_ldap_attribute = "univentionMessageCatalog" |
507 |
translationfile_ldap_attribute = "univentionMessageCatalog" |
502 |
translationfile_ldap_attribute_and_tag_prefix = "%s;entry-lang-" % (translationfile_ldap_attribute,) |
508 |
translationfile_ldap_attribute_and_tag_prefix = "%s;entry-lang-" % (translationfile_ldap_attribute,) |
|
|
509 |
if objectclass == 'univentionUDMModule': |
510 |
prefix = "univention-admin-handlers" |
511 |
elif objectclass == 'univentionUDMSyntax': |
512 |
prefix = "univention-admin-syntax" |
513 |
elif objectclass == 'univentionUDMHook': |
514 |
prefix = "univention-admin-hooks" |
503 |
|
515 |
|
504 |
language_tags = [] |
516 |
language_tags = [] |
505 |
for ldap_attribute in attrs.keys(): |
517 |
for ldap_attribute in attrs.keys(): |
|
512 |
module_name = attrs.get('cn')[0] |
524 |
module_name = attrs.get('cn')[0] |
513 |
for language_tag in language_tags: |
525 |
for language_tag in language_tags: |
514 |
targetdir = os.path.join(LOCALE_BASEDIR, language_tag, 'LC_MESSAGES') |
526 |
targetdir = os.path.join(LOCALE_BASEDIR, language_tag, 'LC_MESSAGES') |
515 |
filename = os.path.join(targetdir, "univention-admin-handlers-%s.mo" % (module_name.replace('/', '-'),) ) |
527 |
filename = os.path.join(targetdir, "%s-%s.mo" % (prefix, module_name.replace('/', '-'),) ) |
516 |
if not os.path.exists(targetdir): |
528 |
if not os.path.exists(targetdir): |
517 |
ud.debug(ud.LISTENER, ud.ERROR, '%s: Error writing %s. Parent directory does not exist.' % (name, filename)) |
529 |
ud.debug(ud.LISTENER, ud.ERROR, '%s: Error writing %s. Parent directory does not exist.' % (name, filename)) |
518 |
continue |
530 |
continue |