Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

occurences_after patch applied (by ptoal)

Signed-off-by: Bartek Górny <bartek@gorny.edu.pl>
  • Loading branch information...
commit b20c331d15f60d4ff3bf0dfd481ea63fef805e83 1 parent 6b9bee6
@akurdyukov akurdyukov authored bartekgorny committed
Showing with 3 additions and 5 deletions.
  1. +2 −2 schedule/models/events.py
  2. +1 −3 schedule/utils.py
View
4 schedule/models/events.py
@@ -156,6 +156,8 @@ def _occurrences_after_generator(self, after=None):
difference = self.end - self.start
while True:
o_start = date_iter.next()
+ if o_start > self.end_recurring_period:
+ raise StopIteration
o_end = o_start + difference
if o_end > after:
yield self._create_occurrence(o_start, o_end)
@@ -436,5 +438,3 @@ def __cmp__(self, other):
def __eq__(self, other):
return self.event == other.event and self.original_start == other.original_start and self.original_end == other.original_end
-
-
View
4 schedule/utils.py
@@ -1,7 +1,6 @@
import datetime
import heapq
-
class EventListManager(object):
"""
This class is responsible for doing functions on a list of events. It is
@@ -40,7 +39,7 @@ def occurrences_after(self, after=None):
try:
next = heapq.heapreplace(occurrences, (generator.next(), generator))[0]
except StopIteration:
- next = heapq.heappop(occurrences)
+ next = heapq.heappop(occurrences)[0]
yield occ_replacer.get_occurrence(next)
@@ -73,4 +72,3 @@ def get_additional_occurrences(self, start, end):
Return persisted occurrences which are now in the period
"""
return [occ for key,occ in self.lookup.items() if (occ.start < end and occ.end >= start and not occ.cancelled)]
-
Please sign in to comment.
Something went wrong with that request. Please try again.