|
38 |
import univention.debug |
38 |
import univention.debug |
39 |
import univention.admin.modules |
39 |
import univention.admin.modules |
40 |
import univention.admin.uexceptions |
40 |
import univention.admin.uexceptions |
41 |
import univention.admin.localization |
41 |
from univention.admin import localization |
42 |
try: |
42 |
try: |
43 |
from univention.lib.ucs import UCS_Version |
43 |
from univention.lib.ucs import UCS_Version |
44 |
from univention.lib.umc_module import get_mime_type, get_mime_description, image_mime_type_of_buffer |
44 |
from univention.lib.umc_module import get_mime_type, get_mime_description, image_mime_type_of_buffer |
|
58 |
import locale |
58 |
import locale |
59 |
from operator import itemgetter |
59 |
from operator import itemgetter |
60 |
|
60 |
|
61 |
translation=univention.admin.localization.translation('univention/admin') |
61 |
translation=localization.translation('univention/admin') |
62 |
_=translation.translate |
62 |
_=translation.translate |
63 |
|
63 |
|
64 |
# |
64 |
# |
65 |
# load all additional syntax files from */site-packages/univention/admin/syntax.d/*.py |
65 |
# load all additional syntax files from */site-packages/univention/admin/syntax.d/*.py |
66 |
# |
66 |
# |
67 |
def import_syntax_files(): |
67 |
def import_syntax_files(): |
|
|
68 |
global _ # don't allow syntax to overwrite our global _ function. |
68 |
gettext = _ |
69 |
gettext = _ |
69 |
for dir_ in sys.path: |
70 |
for dir_ in sys.path: |
70 |
syntax_py = os.path.join(dir_, 'univention/admin/syntax.py') |
71 |
syntax_py = os.path.join(dir_, 'univention/admin/syntax.py') |
Lines 75-86
def import_syntax_files():
|
Link Here
|
---|
|
75 |
|
76 |
|
76 |
for fn in syntax_files: |
77 |
for fn in syntax_files: |
77 |
try: |
78 |
try: |
78 |
fd = open( fn, 'r' ) |
79 |
with open(fn, 'r') as fd: |
79 |
exec fd in univention.admin.syntax.__dict__ |
80 |
exec fd in sys.modules[__name__].__dict__ |
80 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'admin.syntax.import_syntax_files: importing "%s"' % fn) |
81 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'admin.syntax.import_syntax_files: importing "%s"' % fn) |
81 |
except: |
82 |
except: |
82 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'admin.syntax.import_syntax_files: loading %s failed' % fn ) |
83 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'admin.syntax.import_syntax_files: loading %s failed' % fn ) |
83 |
univention.admin.syntax.__dict__['_'] = gettext |
84 |
univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'admin.syntax.import_syntax_files: TRACEBACK:\n%s' % traceback.format_exc() ) |
|
|
85 |
_ = gettext |
86 |
_ = gettext |
84 |
|
87 |
|
85 |
choice_update_functions = [] |
88 |
choice_update_functions = [] |
86 |
def __register_choice_update_function(func): |
89 |
def __register_choice_update_function(func): |
Lines 3050-3056
class Country(select):
|
Link Here
|
---|
|
3050 |
|
3053 |
|
3051 |
@classmethod |
3054 |
@classmethod |
3052 |
def update_choices(cls): |
3055 |
def update_choices(cls): |
3053 |
iso_3166 = univention.admin.localization.translation('iso_3166') |
3056 |
iso_3166 = localization.translation('iso_3166') |
3054 |
iso_3166.set_language(str(translation.locale)) |
3057 |
iso_3166.set_language(str(translation.locale)) |
3055 |
_iso_3166 = iso_3166.translate |
3058 |
_iso_3166 = iso_3166.translate |
3056 |
|
3059 |
|