Browse Source

[EmField] pep8 + pylint

Roland Haroutiounian 9 years ago
parent
commit
a5738476e0
1 changed files with 1 additions and 88 deletions
  1. 1
    88
      EditorialModel/fields.py

+ 1
- 88
EditorialModel/fields.py View File

@@ -2,13 +2,6 @@
2 2
 
3 3
 from EditorialModel.components import EmComponent
4 4
 from EditorialModel.fieldtypes import EmField_boolean, EmField_char, EmField_integer, EmField_icon  # , get_field_type
5
-# from EditorialModel.fieldgroups import EmFieldGroup
6
-# from EditorialModel.classes import EmClass
7
-
8
-# from Database import sqlutils
9
-# from Database.sqlalter import DropColumn, AddColumn
10
-
11
-# import sqlalchemy as sql
12 5
 
13 6
 
14 7
 ## EmField (Class)
@@ -29,90 +22,10 @@ class EmField(EmComponent):
29 22
     ]
30 23
 
31 24
     def __init__(self, datas, model):
32
-        super(EmField,self).__init__(datas, model)
25
+        super(EmField, self).__init__(datas, model)
33 26
 
34 27
     ## @brief Delete a field if it's not linked
35 28
     # @return bool : True if deleted False if deletion aborded
36 29
     # @todo Check if unconditionnal deletion is correct
37 30
     def delete(self):
38 31
         return self.model.delete_component(self.uid)
39
-        # dbe = self.db_engine
40
-        # class_table = sql.Table(self.get_class_table(), sqlutils.meta(dbe))
41
-        # field_col = sql.Column(self.name)
42
-        # ddl = DropColumn(class_table, field_col)
43
-        # sqlutils.ddl_execute(ddl, self.db_engine)
44
-        # return super(EmField, self).delete()
45
-
46
-    ## Create (Function)
47
-    #
48
-    # Creates a new EmField and instanciates it
49
-    #
50
-    # @static
51
-    #
52
-    # @param name str: Name of the field
53
-    # @param fieldgroup EmFieldGroup: Field group in which the field is
54
-    # @param fieldtype EmFieldType: Type of the field
55
-    # @param optional int: is the field optional ? (default=0)
56
-    # @param internal int: is the field internal ? (default=0)
57
-    # @param rel_to_type_id int: default=0
58
-    # @param rel_field_id int: default=0
59
-    # @param icon int: default=0
60
-    # @param **em_component_args : @ref EditorialModel::components::create()
61
-    #
62
-    # @throw TypeError
63
-    # @throw RuntimeError if the associated column creation fails
64
-    # @throw EmComponentExistError if an EmField with this name allready exists in this fieldgroup
65
-    # @see EmComponent::__init__()
66
-    # @staticmethod
67
-    # @classmethod
68
-    # def create(cls, name, fieldgroup, fieldtype, optional=0, internal=0, rel_to_type_id=0, rel_field_id=0, icon=None, **em_component_args):
69
-    #     created_field = super(EmField, cls).create(
70
-    #         name=name,
71
-    #         fieldgroup_id=fieldgroup.uid,
72
-    #         fieldtype=fieldtype.name,
73
-    #         optional=optional,
74
-    #         internal=internal,
75
-    #         rel_to_type_id=rel_to_type_id,
76
-    #         rel_field_id=rel_field_id,
77
-    #         icon=icon,
78
-    #         **em_component_args
79
-    #     )
80
-        # if not created_field.add_field_column_to_class_table():
81
-        #     raise RuntimeError("Unable to create the column for the EmField " + str(created_field))
82
-
83
-        # return created_field
84
-
85
-    ## add_field_column_to_class_table (Function)
86
-    #
87
-    # Adds a column representing the field in its class' table
88
-    #
89
-    # @return True in case of success, False if not
90
-    # def add_field_column_to_class_table(self):
91
-        # dbe = self.db_engine
92
-        # fieldtype = get_field_type(self.fieldtype)
93
-        # new_column = sql.Column(name=self.name, **(fieldtype.sqlalchemy_args()))
94
-        # class_table = sql.Table(self.get_class_table(), sqlutils.meta(dbe))
95
-        # ddl = AddColumn(class_table, new_column)
96
-        # return sqlutils.ddl_execute(ddl, dbe)
97
-
98
-    ## get_class_table (Function)
99
-    #
100
-    # Gets the name of the table of the class corresponding to the field
101
-    #
102
-    # @return Name of the table
103
-    # def get_class_table(self):
104
-    #     return self.get_class().class_table_name
105
-
106
-    ## @brief Get the class that contains this field
107
-    # @return An EmClass instance
108
-    # def get_class(self):
109
-        #<SQL>
110
-        # dbe = self.db_engine
111
-        # meta = sqlutils.meta(dbe)
112
-        # conn = dbe.connect()
113
-        # fieldgroup_table = sql.Table(EmFieldGroup.table, meta)
114
-        # req = fieldgroup_table.select().where(fieldgroup_table.c.uid == self.fieldgroup_id)
115
-        # res = conn.execute(req)
116
-        # row = res.fetchone()
117
-        #</SQL>
118
-        # return EmClass(row['class_id'])

Loading…
Cancel
Save