Browse Source

Fixed a bug in set_rank()

When the list is empty new_rank is > get_max_rank, because get_max_rank returns -1
Yann Weber 9 years ago
parent
commit
2dc226c65a
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      EditorialModel/components.py

+ 1
- 1
EditorialModel/components.py View File

@@ -166,7 +166,7 @@ class EmComponent(object):
166 166
     def set_rank(self, new_rank):
167 167
         if not isinstance(new_rank, int):
168 168
             raise TypeError("Excepted <class int> but got " + str(type(new_rank)))
169
-        if new_rank <= 0 or new_rank > self.get_max_rank():
169
+        if new_rank <= 0 or (new_rank > 1 and new_rank > self.get_max_rank()):
170 170
             raise ValueError("Invalid new rank : " + str(new_rank))
171 171
 
172 172
         mod = new_rank - self.rank  # Indicates the "direction" of the "move"

Loading…
Cancel
Save