From 1f62ec01e46940abaa1d6ff0d089a2bae1ef00a1 Mon Sep 17 00:00:00 2001 From: Roland Haroutiounian Date: Fri, 19 Jun 2015 14:05:00 +0200 Subject: [PATCH] =?UTF-8?q?[#12]=20Ajout=20des=20fonctions=20de=20cr=C3=A9?= =?UTF-8?q?ation=20et=20de=20suppression=20d'entr=C3=A9es=20dans=20em=5Ffi?= =?UTF-8?q?eld=5Ftype?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EditorialModel/types.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/EditorialModel/types.py b/EditorialModel/types.py index 274fe0c..0a19222 100644 --- a/EditorialModel/types.py +++ b/EditorialModel/types.py @@ -1,6 +1,7 @@ #-*- coding: utf-8 -*- from EditorialModel.components import EmComponent, EmComponentNotExistError +from EditorialModel.fields_types import Em_Field_Type from Database import sqlutils import sqlalchemy as sql @@ -64,19 +65,27 @@ class EmType(EmComponent): return res pass - ## Indicate that an optionnal field is used + ## Select_field (Function) + # + # Indicates that an optional field is used + # # @param field EmField: The optional field to select - # @throw TypeError if field is not an EmField - # @throw ValueError if field is not an optionnal field + # @throw ValueError, TypeError + # @todo change exception type and define return value and raise condition def select_field(self, field): - pass + Em_Field_Type.create(self, field) - ## Indicate that an optionnal field will not be used (anymore) - # @param field EmField: The optionnal field to unselect - # @throw TypeError if field is not an EmField - # @throw ValueError if field is not an optionnal field + ## Unselect_field (Function) + # + # Indicates that an optional field will not be used + # + # @param field EmField: The optional field to unselect + # @throw ValueError, TypeError + # @todo change exception type and define return value and raise condition def unselect_field(self, field): - pass + emFieldType = Em_Field_Type(self.uid, field.uid) + emFieldType.delete() + del emFieldType ## Get the list of associated hooks # @note Not conceptualized yet