Browse Source

Super corrector a la rescousse

Driky 10 years ago
parent
commit
0c5301a235
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      EditorialModel/components.py

+ 5
- 1
EditorialModel/components.py View File

@@ -164,6 +164,10 @@ class EmComponent(object):
164 164
                 dbe = self.__class__.getDbE()
165 165
                 component = sql.Table(self.table, sqlutils.meta(dbe))
166 166
                 req = sql.sql.select([component.c.uid, component.c.rank])
167
+
168
+                if(type(sign) is not str):
169
+                    logger.error("Bad argument")
170
+                    raise TypeError('Excepted a string (\'=\' or \'+\' or \'-\') not a '+str(type(sign)))
167 171
                 if(sign == '='):
168 172
                     req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank == new_rank))
169 173
                     c = dbe.connect()
@@ -247,7 +251,7 @@ class EmComponent(object):
247 251
                         raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
248 252
                 else:
249 253
                     logger.error("Bad argument")
250
-                    raise TypeError('Excepted a string (\'=\' or \'+\' or \'-\') not a '+str((sign)))
254
+                    raise ValueError('Excepted a string (\'=\' or \'+\' or \'-\') not a '+str((sign)))
251 255
             else:
252 256
                 logger.error("Bad argument")
253 257
                 raise ValueError('Excepted a positive int not a negative. new_rank = '+str((new_rank)))

Loading…
Cancel
Save