Browse Source

Fixing some doxygen comments errors

Yann Weber 9 years ago
parent
commit
930bf7ba3a

+ 2
- 0
DataSource/MySQL/fieldtypes.py View File

@@ -17,6 +17,7 @@ import EditorialModel.fieldtypes.leo
17 17
 
18 18
 ## @brief Returns column specs from fieldtype
19 19
 # @param emfieldtype EmFieldType : An EmFieldType insance
20
+# @param noauto_inc bool : if True don't set the autoincrement parameter
20 21
 # @todo escape default value
21 22
 def singlevaluefieldtype_db_init_specs(emfieldtype, noauto_inc = False):
22 23
     colspec = ''
@@ -46,6 +47,7 @@ def singlevaluefieldtype_db_init_specs(emfieldtype, noauto_inc = False):
46 47
 #  - the second tuple item is a tuple(key_name, key_value)
47 48
 #  - the third tuple item is a tuple(column_type, column_spec)
48 49
 # @param fieldtype GenericFieldType : A FieldType instance
50
+# @param noauto_inc bool : if True don't set the autoincrement parameter
49 51
 # @return a tuple (instruction_type, infos)
50 52
 def fieldtype_db_init(fieldtype, noauto_inc = False):
51 53
     if isinstance(fieldtype, EditorialModel.fieldtypes.rel2type.EmFieldType):

+ 8
- 5
DataSource/MySQL/leapidatasource.py View File

@@ -38,8 +38,13 @@ class LeDataSourceSQL(DummyDatasource):
38 38
     ## @brief select lodel editorial components using given filters
39 39
     # @param target_cls LeCrud(class): The component class concerned by the select (a LeCrud child class (not instance !) )
40 40
     # @param field_list list: List of field to fetch
41
-    # @param filters list: List of filters (see @ref lecrud_filters)
42
-    # @param rel_filters list: List of relational filters (see @ref lecrud_filters)
41
+    # @param filters list: List of filters (see @ref api_user_side)
42
+    # @param rel_filters list: List of relational filters (see @ref api_user_side)
43
+    # @param group list of tupple: List of column to group together.  group = [('titre', 'ASC'), ]
44
+    # @param order list of tupple : List of column to order.  order = [('titre', 'ASC'), ]
45
+    # @param offset int : Used with limit to choose the start row
46
+    # @param limit int : Number of row to be returned
47
+    # @param instanciate bool : If True return an instance, else return a dict
43 48
     # @return a list of LeCrud child classes
44 49
     # @todo this only works with LeObject.get(), LeClass.get() and LeType.get()
45 50
     # @todo for speed get rid of all_to_dicts
@@ -209,10 +214,8 @@ class LeDataSourceSQL(DummyDatasource):
209 214
     ## @brief update ONE existing lodel editorial component
210 215
     # @param target_cls LeCrud(class) : Instance of the object concerned by the update
211 216
     # @param lodel_id : id of the component
212
-    # @param rel_filters list : List of relationnal filters (see @ref leobject_filters)
213 217
     # @param **datas : Datas in kwargs
214 218
     # @return the number of updated components
215
-    # @todo implement other filters than lodel_id
216 219
     def update(self, target_cls, lodel_id, **datas):
217 220
 
218 221
         # it is a LeType
@@ -390,7 +393,7 @@ class LeDataSourceSQL(DummyDatasource):
390 393
 
391 394
     ## @brief Sets a new rank on a relation
392 395
     # @param le_relation LeRelation
393
-    # @param new_rank int: integer representing the absolute new rank
396
+    # @param rank int: integer representing the absolute new rank
394 397
     # @return True if success, False if failure
395 398
     # TODO Conserver cette méthode dans le datasource du fait des requêtes SQL. Elle est appelée par le set_rank de LeRelation
396 399
     def update_rank(self, le_relation, rank):

+ 24
- 14
DataSource/MySQL/migrationhandler.py View File

@@ -46,6 +46,8 @@ class MysqlMigrationHandler(DummyMigrationHandler):
46 46
     ## @brief Construct a MysqlMigrationHandler
47 47
     # @param module : sql module
48 48
     # @param conn_args dict : A dict containing connection options
49
+    # @param db_engine str : Name of a MySQL db engine (default is InnoDB, don't change it ! ;) ) 
50
+    # @param **kwargs : arguement given to the module.connect() method
49 51
     def __init__(self, module=pymysql, conn_args=None, db_engine='InnoDB', **kwargs):
50 52
         # Database connection
51 53
         self._dbmodule = module
@@ -74,6 +76,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
74 76
     # @param uid int : The uid of the change EmComponent
75 77
     # @param initial_state dict | None : dict with field name as key and field value as value. Representing the original state. None mean creation of a new component.
76 78
     # @param new_state dict | None : dict with field name as key and field value as value. Representing the new state. None mean component deletion
79
+    # @param engine str : Mysql db engine, should be "InnoDB"
77 80
     # @throw EditorialModel.exceptions.MigrationHandlerChangeError if the change was refused
78 81
     def register_change(self, em, uid, initial_state, new_state, engine=None):
79 82
         if engine is None:
@@ -114,7 +117,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
114 117
     ## @brief Add a relationnal field
115 118
     # Add a rel2type attribute
116 119
     # @note this function handles the table creation
117
-    # @param em Model : EditorialModel.model.Model instance
120
+    # @param edmod Model : EditorialModel.model.Model instance
118 121
     # @param rfuid int : Relationnal field uid
119 122
     def add_relationnal_field(self, edmod, rfuid):
120 123
         emfield = edmod.component(rfuid)
@@ -146,7 +149,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
146 149
     #
147 150
     # Delete a rel2type attribute
148 151
     # @note this method handles the table deletion
149
-    # @param em Model : EditorialModel.model.Model instance
152
+    # @param edmod Model : EditorialModel.model.Model instance
150 153
     # @param rfuid int : Relationnal field uid
151 154
     def del_relationnal_field(self, edmod, rfuid):
152 155
         emfield = edmod.component(rfuid)
@@ -165,7 +168,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
165 168
             self._generate_triggers(tname, self._r2type2cols(edmod, r2tf))
166 169
 
167 170
     ## @brief Given an EmField uid add a column to the corresponding table
168
-    # @param em Model : A Model instance
171
+    # @param edmod Model : A Model instance
169 172
     # @param uid int : An EmField uid
170 173
     def add_col_from_emfield(self, edmod, uid):
171 174
         emfield = edmod.component(uid)
@@ -180,8 +183,9 @@ class MysqlMigrationHandler(DummyMigrationHandler):
180 183
         self._generate_triggers(tname, cols_l)
181 184
 
182 185
     ## @brief Given a class uid create the coressponding table
183
-    # @param em Model : A Model instance
186
+    # @param edmod Model : A Model instance
184 187
     # @param uid int : An EmField uid
188
+    # @param engine str : Db engine (should be "InnoDB")
185 189
     def create_emclass_table(self, edmod, uid, engine):
186 190
         emclass = edmod.component(uid)
187 191
         if not isinstance(emclass, EditorialModel.classes.EmClass):
@@ -199,7 +203,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
199 203
             self._add_fk(table_name, utils.common_tables['object'], pkname, pkname)
200 204
 
201 205
     ## @brief Given an EmClass uid delete the corresponding table
202
-    # @param em Model : A Model instance
206
+    # @param edmod Model : A Model instance
203 207
     # @param uid int : An EmField uid
204 208
     def delete_emclass_table(self, edmod, uid):
205 209
         emclass = edmod.component(uid)
@@ -214,7 +218,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
214 218
         self._query("""DROP TABLE {table_name};""".format(table_name=tname))
215 219
 
216 220
     ## @brief Given an EmField delete the corresponding column
217
-    # @param em Model : an @ref EditorialModel.model.Model instance
221
+    # @param edmod Model : an @ref EditorialModel.model.Model instance
218 222
     # @param uid int : an EmField uid
219 223
     def delete_col_from_emfield(self, edmod, uid):
220 224
         emfield = edmod.component(uid)
@@ -244,7 +248,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
244 248
         self._query("""ALTER TABLE {table_name} DROP COLUMN {col_name};""".format(table_name=tname, col_name=fname))
245 249
 
246 250
     ## @brief Construct a table name given a rela2type EmField instance
247
-    # @param em Model : A Model instance
251
+    # @param edmod Model : A Model instance
248 252
     # @param emfield EmField : An EmField instance
249 253
     # @return a table name
250 254
     def _r2t2table_name(self, edmod, emfield):
@@ -253,7 +257,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
253 257
         return utils.r2t_table_name(emclass.name, emtype.name)
254 258
 
255 259
     ## @brief Generate a columns_fieldtype dict given a rel2type EmField
256
-    # @param em Model : an @ref EditorialModel.model.Model instance
260
+    # @param edmod Model : an @ref EditorialModel.model.Model instance
257 261
     # @param emfield EmField : and @ref EditorialModel.fields.EmField instance
258 262
     def _r2type2cols(self, edmod, emfield):
259 263
         return {f.name: f.fieldtype_instance() for f in edmod.components('EmField') if f.rel_field_id == emfield.uid}
@@ -316,7 +320,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
316 320
     # @param pk_ftype fieldtype | tuple : pk fieldtype (give a tuple for multi pk)
317 321
     # @param engine str : The engine to use with this table
318 322
     # @param charset str : The charset of this table
319
-    # @param if_exist str : takes values in ['nothing', 'drop']
323
+    # @param if_exists str : takes values in ['nothing', 'drop']
320 324
     # @param noauto_inc bool : if True forbids autoincrement on PK
321 325
     def _create_table(self, table_name, pk_name, pk_ftype, engine, charset='utf8', if_exists='nothing', noauto_inc = False):
322 326
         #Escaped table name
@@ -359,6 +363,7 @@ class MysqlMigrationHandler(DummyMigrationHandler):
359 363
     # @param col_name str : The columns name
360 364
     # @param col_fieldtype EmFieldype the fieldtype
361 365
     # @param relation bool | None : a flag to indicate if we add a column in a table linked with an bject or with a relation (used only when the column is MultiValueFieldType )
366
+    # @param drop_if_exists bool : if True delete the column before re-adding it
362 367
     # @return True if the column was added else return False
363 368
     def _add_column(self, table_name, col_name, col_fieldtype, drop_if_exists=False, relation=False):
364 369
         instr, col_type, col_specs = fieldtypes_utils.fieldtype_db_init(col_fieldtype)
@@ -437,6 +442,7 @@ ADD COLUMN {col_name} {col_type} {col_specs};"""
437 442
     # @param ref_table_name str : Referenced table name
438 443
     # @param key_infos tuple : tuple(key_name, key_fieldtype)
439 444
     # @param column_infos tuple : tuple(col_name, col_fieldtype)
445
+    # @param relation bool : pass True if concern a LeRelation or False of concern a LeObject
440 446
     def _add_column_multivalue(self, ref_table_name, key_infos, column_infos, relation):
441 447
         key_name, key_ftype = key_infos
442 448
         col_name, col_ftype = column_infos
@@ -481,6 +487,7 @@ ADD COLUMN {col_name} {col_type} {col_specs};"""
481 487
     # @param dst_table_name str : The name of the table the FK will point on
482 488
     # @param src_col_name str : The name of the concerned column in the src_table
483 489
     # @param dst_col_name str : The name of the concerned column in the dst_table
490
+    # @param fk_name str|None : The foreign key name, if None the name will be generated (not a good idea)
484 491
     def _add_fk(self, src_table_name, dst_table_name, src_col_name, dst_col_name, fk_name=None):
485 492
         stname = utils.escape_idname(src_table_name)
486 493
         dtname = utils.escape_idname(dst_table_name)
@@ -507,6 +514,7 @@ ON UPDATE CASCADE;""".format(
507 514
     ## @brief Given a source and a destination table, delete the corresponding FK
508 515
     # @param src_table_name str : The name of the table where the FK is
509 516
     # @param dst_table_name str : The name of the table the FK point on
517
+    # @param fk_name str|None : the foreign key name, if None try to guess it
510 518
     # @warning fails silently
511 519
     def _del_fk(self, src_table_name, dst_table_name, fk_name=None):
512 520
         if fk_name is None:
@@ -543,11 +551,12 @@ DROP FOREIGN KEY {fk_name}""".format(
543 551
     #
544 552
     # Primarly designed to create trigger for DATETIME types
545 553
     # The method generates triggers of the form
546
-    #
547
-    # CREATE TRIGGER BEFORE <moment> ON <table_name>
548
-    # FOR EACH ROW SET <for colname, colval in cols_val>
549
-    # NEW.<colname> = <colval>,
550
-    # <endfor>;
554
+    # <pre>
555
+    # CREATE TRIGGER BEFORE &lt;moment&gt; ON &lt;table_name&gt;
556
+    # FOR EACH ROW SET lt;for colname, colval in &lt;cols_val&gt;
557
+    # NEW.lt;colname> = lt;colval&gt;,
558
+    # lt;endfor&gt;;
559
+    # </pre>
551 560
     # @param table_name str : The table name
552 561
     # @param moment str : can be 'update' or 'insert'
553 562
     # @param cols_val dict : Dict with column name as key and column value as value
@@ -618,6 +627,7 @@ FOR EACH ROW SET {col_val_list};""".format(
618 627
         self.db_conn.commit()  # autocommit
619 628
 
620 629
     ## @brief Given a common field name return an EmFieldType instance
630
+    # @param cls
621 631
     # @param cname str : Common field name
622 632
     # @return An EmFieldType instance
623 633
     @classmethod

+ 2
- 1
DataSource/MySQL/utils.py View File

@@ -51,7 +51,8 @@ def get_fk_name(src_table_name, dst_table_name):
51 51
 
52 52
 
53 53
 ## @brief Exec a query
54
-# @param query str : SQL query
54
+# @param connection : Db connection (has returned by dbmodule.connect())
55
+# @param query_string str : SQL query
55 56
 def query(connection, query_string):
56 57
     if Settings.debug_sql:
57 58
         print("SQL : ", query_string)

+ 2
- 0
DataSource/dummy/leapidatasource.py View File

@@ -13,12 +13,14 @@ class DummyDatasource(object):
13 13
 
14 14
     ## @brief select lodel editorial components given filters
15 15
     # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
16
+    # @param field_list list : List of field names we want in the returned value or instance
16 17
     # @param filters list : List of filters (see @ref leobject_filters )
17 18
     # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
18 19
     # @param group list of tupple: List of column to group together.  group = [('titre', 'ASC'), ]
19 20
     # @param order list of tupple : List of column to order.  order = [('titre', 'ASC'), ]
20 21
     # @param limit int : Number of row to be returned
21 22
     # @param offset int : Used with limit to choose the start row
23
+    # @param instanciate bool : If True return an instance, else return a dict
22 24
     # @return a list of LeCrud child classes
23 25
     def select(self, target_cls, field_list, filters, rel_filters=None, order=None, group=None, limit=None, offset=0, instanciate=True):
24 26
         pass

+ 2
- 0
EditorialModel/fieldtypes/format.py View File

@@ -9,7 +9,9 @@ class EmFieldType(char.EmFieldType):
9 9
 
10 10
     ## @brief Build its content with a field list and a format string
11 11
     # @param format_string str :  
12
+    # @param max_length int : The maximum length of the handled value
12 13
     # @param field_list list : List of field to use
14
+    # @param **kwargs
13 15
     def __init__(self, format_string, field_list, max_length, **kwargs):
14 16
         self._field_list = field_list
15 17
         self._format_string = format_string

+ 5
- 1
EditorialModel/fieldtypes/generic.py View File

@@ -17,6 +17,7 @@ class GenericFieldType(object):
17 17
     ## @brief Generic constructor for fieldtypes 
18 18
     # @param internal False | str : define wheter or not a field is internal
19 19
     # @param immutable bool : indicate if the fieldtype has to be defined in child classes of LeObject or if it is defined globally and immutable
20
+    # @param **args
20 21
     # @throw NotImplementedError if called from bad class
21 22
     def __init__(self, internal = False, immutable = False, **args):
22 23
         if self.__class__ == GenericFieldType:
@@ -62,7 +63,7 @@ class GenericFieldType(object):
62 63
         raise RuntimeError("Unable to construct data for field %s", fname)
63 64
 
64 65
     ## @brief Check datas consistency
65
-    # @param leo LeCrud : A LeCrud child class instance
66
+    # @param lec LeCrud : A LeCrud child class instance
66 67
     # @param fname str : The field name
67 68
     # @param datas dict : dict storing fields values
68 69
     # @return an Exception instance if fails else True
@@ -134,6 +135,7 @@ class ReferenceFieldType(SingleValueFieldType):
134 135
     # @param nullable bool : is None allowed as value ?
135 136
     # @param unique bool : Indicate if a field should handle uniq value
136 137
     # @param primary bool : If True the field is a primary key
138
+    # @param internal str|False : if False the field is not internal. Else can be 'autosql' or 'internal'
137 139
     # @param **args : Other arguments
138 140
     # @throw NotImplementedError if called from bad class
139 141
     def __init__(self, reference, internal=False, nullable = True, uniq = False, primary = False, **args):
@@ -161,6 +163,8 @@ class MultiValueFieldType(GenericFieldType):
161 163
     # @param keyname str : The identifier key name
162 164
     # @param key_fieldtype SingleValueFieldType : A SingleValueFieldType child class instance
163 165
     # @param value_fieldtype SingleValueFieldType : A SingleValueFieldType child class instance
166
+    # @param internal str|False : if False the field is not internal. Else can be 'autosql' or 'internal'
167
+    # @param **args
164 168
     def __init__(self, keyname, key_fieldtype, value_fieldtype, internal = False, **args):
165 169
         super().__init__(internal)
166 170
         ## stores the keyname

+ 2
- 2
Lodel/settings.py View File

@@ -126,11 +126,11 @@ Settings = SettingsHandler()
126 126
 # from Lodel.settings import Settings
127 127
 # if Settings.debug:
128 128
 #   print("DEBUG")
129
-# #or
129
+# # or
130 130
 # if Settings.get('debug'):
131 131
 #   print("DEBUG")
132 132
 # Settings.debug = False
133
-# #or
133
+# # or
134 134
 # Settings.set('debug', False)
135 135
 # </pre>
136 136
 # 

Loading…
Cancel
Save