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
                 dbe = self.__class__.getDbE()
164
                 dbe = self.__class__.getDbE()
165
                 component = sql.Table(self.table, sqlutils.meta(dbe))
165
                 component = sql.Table(self.table, sqlutils.meta(dbe))
166
                 req = sql.sql.select([component.c.uid, component.c.rank])
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
                 if(sign == '='):
171
                 if(sign == '='):
168
                     req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank == new_rank))
172
                     req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank == new_rank))
169
                     c = dbe.connect()
173
                     c = dbe.connect()
247
                         raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
251
                         raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
248
                 else:
252
                 else:
249
                     logger.error("Bad argument")
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
             else:
255
             else:
252
                 logger.error("Bad argument")
256
                 logger.error("Bad argument")
253
                 raise ValueError('Excepted a positive int not a negative. new_rank = '+str((new_rank)))
257
                 raise ValueError('Excepted a positive int not a negative. new_rank = '+str((new_rank)))

Loading…
Cancel
Save