def insertAttribute( customAttribute, *args, **kwargs ): """ Adds new attribute to the list of custom attributes.""" location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName ) errors = [] errors = CustomAttributesManagerBase.checkAttribute( customAttribute ) if errors: raise str( errors ) attsList = CustomAttributesManager.getAttributes( location = location ) attsList.append( customAttribute ) CustomAttributesManager.setAttributes( attsList, location = location )
def setAttributes( attsList, *args, **kwargs ): location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName ) for at in attsList: errors = CustomAttributesManagerBase.checkAttribute( at ) if errors: raise str( errors ) dic = CustomAttributesManager.getRoot() dic[location] = attsList root = Factory.getDALManager().root root[_CUSTOM_ATTRIBUTES_LIST] = dic