equal
deleted
inserted
replaced
1 import datetime |
1 import datetime |
2 import hashlib |
2 import hashlib |
|
3 import itertools |
3 import logging |
4 import logging |
4 import os.path |
5 import os.path |
5 |
6 |
6 import django.core.files.storage |
7 import django.core.files.storage |
7 import django.utils.http |
8 import django.utils.http |
167 date = self.now().date() |
168 date = self.now().date() |
168 |
169 |
169 return date, self.publishing_timetz, self.publishing_offset |
170 return date, self.publishing_timetz, self.publishing_offset |
170 |
171 |
171 @classmethod |
172 @classmethod |
172 def apply_publishing_schedule (self, date, time, offset, count) : |
173 def apply_publishing_schedule (self, date, time, offset, count=None) : |
173 """Yield publishing times off given date/time to offset * count.""" |
174 """ |
174 for index in xrange(0, count) : |
175 Yield publishing times off given date/time to offset * count. |
|
176 |
|
177 If count is not given, yields an infinite series of publish-datetimes. |
|
178 """ |
|
179 |
|
180 if count: |
|
181 iter = xrange(count) |
|
182 else: |
|
183 iter = itertools.count() |
|
184 |
|
185 for index in iter: |
175 yield datetime.datetime.combine(date + offset * index, time) |
186 yield datetime.datetime.combine(date + offset * index, time) |
176 |
187 |
177 def __unicode__ (self) : |
188 def __unicode__ (self) : |
178 return self.shorturl |
189 return self.shorturl |
179 |
190 |