View | Details | Raw Unified | Return to bug 43129 | Differences between
and this patch

Collapse All | Expand All

(-)a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py (-1 / +29 lines)
 Lines 930-941   def description(self): Link Here 
930
	def _post_unmap(self, info, values):
930
	def _post_unmap(self, info, values):
931
		"""This method can be overwritten to define special un-map
931
		"""This method can be overwritten to define special un-map
932
		methods that can not be done with the default mapping API"""
932
		methods that can not be done with the default mapping API"""
933
		univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'modules/__init__.py _post_unmap called with info=[%r] values=[%r]' % (info, values))
934
		# Allow the fromLDAP() method of the syntax class to convert
935
		# a raw LDAP value into UDM-specific representation
936
		for field in info:
937
			property_ = self.description.get(field)
938
			if not property_ or not hasattr(property_.syntax, 'fromLDAP'):
939
				continue
940
			value = info[field]
941
			if isinstance(value, (list, tuple)):
942
				value = [property_.syntax.fromLDAP(x) for x in value]
943
			else:
944
				value = property_.syntax.fromLDAP(value)
945
			info[field] = value
946
933
		return info
947
		return info
934
948
935
	def _post_map(self, modlist, diff):
949
	def _post_map(self, modlist, diff):
936
		"""This method can be overwritten to define special map methods
950
		"""This method can be overwritten to define special map methods
937
		that can not be done with the default mapping API"""
951
		that can not be done with the default mapping API"""
938
		return modlist
952
		univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'modules/__init__.py _post_map called with modlist=[%r] diff=[%r]' % (modlist, diff))
953
		ml = []
954
		for tuple_ in modlist:
955
			try:
956
				key, old, new = tuple_
957
			except ValueError:
958
				old = None
959
				key, new = tuple_
960
			property_ = self.descriptions.get(key)
961
			if not property_ or not hasattr(property_.syntax, 'toLDAP'):
962
				ml.append(tuple_)
963
				continue
964
			new = property_.syntax.toLDAP(new)
965
			ml.append((key, old, new))
966
		return ml
939
967
940
	def _ldap_modlist(self):
968
	def _ldap_modlist(self):
941
		"""Builds the list of modifications when creating and modifying this object.
969
		"""Builds the list of modifications when creating and modifying this object.

Return to bug 43129