View | Details | Raw Unified | Return to bug 36658
Collapse All | Expand All

(-)a/ucs-4.0-0/management/univention-management-console/src/univention/management/console/protocol/session.py (-7 / +15 lines)
 Lines 41-46   import sys Link Here 
41
import time
41
import time
42
import json
42
import json
43
import traceback
43
import traceback
44
from struct import error as StructError
44
45
45
import ldap.filter
46
import ldap.filter
46
47
 Lines 386-391   class Processor(signals.Provider): Link Here 
386
			CORE.warn('Failed to open UDM user object %s: %s' % (self.__user_dn, e))
387
			CORE.warn('Failed to open UDM user object %s: %s' % (self.__user_dn, e))
387
		return None
388
		return None
388
389
390
	def _translate(self, message, translationId):
391
		try:
392
			return self.i18n._(message, translationId)
393
		except StructError:
394
			CORE.error('Corrupted .mo file detected for translation domain %r' % (translationId,))
395
			return message
396
389
	def handle_request_get(self, msg):
397
	def handle_request_get(self, msg):
390
		"""Handles a GET request. The following possible variants are supported:
398
		"""Handles a GET request. The following possible variants are supported:
391
399
 Lines 442-453   class Processor(signals.Provider): Link Here 
442
						modules.append({
450
						modules.append({
443
							'id': id,
451
							'id': id,
444
							'flavor': flavor.id,
452
							'flavor': flavor.id,
445
							'name': self.i18n._(flavor.name, translationId),
453
							'name': self._translate(flavor.name, translationId),
446
							'description': self.i18n._(flavor.description, translationId),
454
							'description': self._translate(flavor.description, translationId),
447
							'icon': flavor.icon,
455
							'icon': flavor.icon,
448
							'categories': (flavor.categories or module.categories) + favcat,
456
							'categories': (flavor.categories or module.categories) + favcat,
449
							'priority': flavor.priority,
457
							'priority': flavor.priority,
450
							'keywords': list(set(flavor.keywords + [self.i18n._(keyword, translationId) for keyword in flavor.keywords]))
458
							'keywords': list(set(flavor.keywords + [self._translate(keyword, translationId) for keyword in flavor.keywords]))
451
						})
459
						})
452
				else:
460
				else:
453
					favcat = []
461
					favcat = []
 Lines 455-466   class Processor(signals.Provider): Link Here 
455
						favcat.append('_favorites_')
463
						favcat.append('_favorites_')
456
					modules.append({
464
					modules.append({
457
						'id': id,
465
						'id': id,
458
						'name': self.i18n._(module.name, id),
466
						'name': self._translate(module.name, id),
459
						'description': self.i18n._(module.description, id),
467
						'description': self._translate(module.description, id),
460
						'icon': module.icon,
468
						'icon': module.icon,
461
						'categories': module.categories + favcat,
469
						'categories': module.categories + favcat,
462
						'priority': module.priority,
470
						'priority': module.priority,
463
						'keywords': list(set(module.keywords + [self.i18n._(keyword, id) for keyword in module.keywords]))
471
						'keywords': list(set(module.keywords + [self._translate(keyword, id) for keyword in module.keywords]))
464
					})
472
					})
465
			res.body['modules'] = modules
473
			res.body['modules'] = modules
466
			CORE.info('Modules: %s' % (modules,))
474
			CORE.info('Modules: %s' % (modules,))
 Lines 475-481   class Processor(signals.Provider): Link Here 
475
					'id': catID,
483
					'id': catID,
476
					'icon': category.icon,
484
					'icon': category.icon,
477
					'color': category.color,
485
					'color': category.color,
478
					'name': self.i18n._(category.name, category.domain).format(**_ucr_dict),
486
					'name': self._translate(category.name, category.domain).format(**_ucr_dict),
479
					'priority': category.priority
487
					'priority': category.priority
480
				})
488
				})
481
			res.body['categories'] = categories
489
			res.body['categories'] = categories

Return to bug 36658