Browse Source

[#46] Commented the to_sql methods

Roland Haroutiounian 9 years ago
parent
commit
53eb1ac57d
1 changed files with 14 additions and 13 deletions
  1. 14
    13
      EditorialModel/fieldtypes.py

+ 14
- 13
EditorialModel/fieldtypes.py View File

@@ -388,8 +388,8 @@ class EmField_integer(EmFieldType):
388 388
 
389 389
     ##
390 390
     # @todo catch cast error ?
391
-    def to_sql(self, value):
392
-        return value
391
+    #def to_sql(self, value):
392
+    #    return value
393 393
 
394 394
     def to_value(self, value):
395 395
         if value == None:
@@ -408,10 +408,9 @@ class EmField_boolean(EmFieldType):
408 408
         #Type enforcing
409 409
         kwargs = self.__class__._setType(kwargs, 'boolean')
410 410
         super(EmField_boolean, self).__init__(**kwargs)
411
-        pass
412 411
 
413
-    def to_sql(self, value):
414
-        return 1 if super(EmField_boolean, self).to_sql(value) else 0
412
+    #def to_sql(self, value):
413
+    #    return 1 if super(EmField_boolean, self).to_sql(value) else 0
415 414
 
416 415
     def to_value(self, value):
417 416
         if value == None:
@@ -425,7 +424,9 @@ class EmField_boolean(EmFieldType):
425 424
 # @note Default 'name' is 'char'
426 425
 # @note Default 'type_length' is 76
427 426
 class EmField_char(EmFieldType):
427
+
428 428
     default_length = 76
429
+
429 430
     def __init__(self, **kwargs):
430 431
         self._init(kwargs)
431 432
         kwargs = self.__class__._argDefault(kwargs, 'type_length', self.__class__.default_length)
@@ -433,8 +434,9 @@ class EmField_char(EmFieldType):
433 434
         #Type enforcing
434 435
         kwargs = self.__class__._setType(kwargs, 'varchar')
435 436
         super(EmField_char, self).__init__(**kwargs)
436
-    def to_sql(self, value):
437
-        return str(value)
437
+
438
+    #def to_sql(self, value):
439
+    #    return str(value)
438 440
 
439 441
 
440 442
 ## @brief Handles date fields
@@ -449,8 +451,8 @@ class EmField_date(EmFieldType):
449 451
         kwargs = self.__class__._setType(kwargs, 'datetime')
450 452
         super(EmField_date, self).__init__(**kwargs)
451 453
 
452
-    def to_sql(self, value):
453
-        return value #thanks to sqlalchemy
454
+    #def to_sql(self, value):
455
+    #    return value #thanks to sqlalchemy
454 456
 
455 457
     def to_value(self, value):
456 458
         if value == None:
@@ -470,8 +472,8 @@ class EmField_mlstring(EmField_char):
470 472
         kwargs = self.__class__._argDefault(kwargs, 'name', 'mlstr')
471 473
         super(EmField_mlstring, self).__init__(**kwargs)
472 474
 
473
-    def to_sql(self, value):
474
-        return value.__str__()
475
+    #def to_sql(self, value):
476
+    #    return value.__str__()
475 477
 
476 478
     def to_value(self, value):
477 479
         if value == None:
@@ -485,9 +487,8 @@ class EmField_mlstring(EmField_char):
485 487
 
486 488
 ## @brief Handles lodel uid fields
487 489
 class EmField_uid(EmField_integer):
490
+
488 491
     def __init__(self, **kwargs):
489 492
         self._init(kwargs)
490 493
         kwargs = self.__class__._argEnforce(kwargs, 'primarykey', True)
491 494
         super(EmField_uid, self).__init__(**kwargs)
492
-        pass
493
-

Loading…
Cancel
Save