Commit 8d1432c6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support __getitem__ with negative value except -1.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18539 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 46fbe062
...@@ -631,6 +631,9 @@ class WorkflowHistoryList(Persistent): ...@@ -631,6 +631,9 @@ class WorkflowHistoryList(Persistent):
if index == -1: if index == -1:
return self._slots[-1] return self._slots[-1]
elif isinstance(index, (int, long)): elif isinstance(index, (int, long)):
if index < 0:
# XXX this implementation is not so good, but rarely used.
index += len(self)
iterator = self.__iter__() iterator = self.__iter__()
for i in xrange(index): for i in xrange(index):
iterator.next() iterator.next()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment