|
@@ -165,16 +165,16 @@ class EmComponent(object):
|
165
|
165
|
component = sql.Table(self.table, sqlutils.meta(dbe))
|
166
|
166
|
req = sql.sql.select([component.c.uid, component.c.rank])
|
167
|
167
|
if(sign == '='):
|
168
|
|
- req = req.where(getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in) and component.c.rank == new_rank)
|
|
168
|
+ req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank == new_rank))
|
169
|
169
|
c = dbe.connect()
|
170
|
170
|
res = c.execute(req)
|
171
|
171
|
res = res.fetchone()
|
172
|
172
|
c.close()
|
173
|
173
|
if(res != None):
|
174
|
174
|
if(new_rank < self.rank):
|
175
|
|
- req = req.where(getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in), sql.and_( component.c.rank >= new_rank), sql.and_ (component.c.rank < self.rank))
|
|
175
|
+ req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & ( component.c.rank >= new_rank) & (component.c.rank < self.rank))
|
176
|
176
|
else:
|
177
|
|
- req = req.where(getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in), sql.and_(component.c.rank <= new_rank), sql.and_ (component.c.rank > self.rank))
|
|
177
|
+ req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank <= new_rank) & (component.c.rank > self.rank))
|
178
|
178
|
|
179
|
179
|
c = dbe.connect()
|
180
|
180
|
res = c.execute(req)
|
|
@@ -202,7 +202,7 @@ class EmComponent(object):
|
202
|
202
|
raise ValueError('new_rank to big, new_rank - 1 doesn\'t exist. new_rank = '+str((new_rank)))
|
203
|
203
|
elif(sign == '+'):
|
204
|
204
|
if(new_rank != 0):
|
205
|
|
- req = req.where(getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in), sql.and_(component.c.rank <= self.rank + new_rank), sql.and_ (component.c.rank > self.rank))
|
|
205
|
+ req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank <= self.rank + new_rank) & (component.c.rank > self.rank))
|
206
|
206
|
|
207
|
207
|
c = dbe.connect()
|
208
|
208
|
res = c.execute(req)
|
|
@@ -225,7 +225,7 @@ class EmComponent(object):
|
225
|
225
|
raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
|
226
|
226
|
elif(sign == '-'):
|
227
|
227
|
if(new_rank != 0):
|
228
|
|
- req = req.where(getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in), sql.and_ (component.c.rank >= self.rank - new_rank), sql.and_(component.c.rank < self.rank))
|
|
228
|
+ req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank >= self.rank - new_rank) & (component.c.rank < self.rank))
|
229
|
229
|
|
230
|
230
|
c = dbe.connect()
|
231
|
231
|
res = c.execute(req)
|