added override of one month OL cache [#33377581]

pull/1/head
eric 2012-07-27 15:58:16 -04:00
parent 7bf94b3925
commit 184dfedda9
2 changed files with 3 additions and 3 deletions

View File

@ -444,8 +444,8 @@ def merge_works(w1, w2, user=None):
w2.delete()
def add_openlibrary(work):
if work.openlibrary_lookup is not None:
def add_openlibrary(work, hard_refresh = False):
if (not hard_refresh) and work.openlibrary_lookup is not None:
# don't hit OL if we've visited in the past month or so
if now()- work.openlibrary_lookup < timedelta(days=30):
return

View File

@ -10,4 +10,4 @@ class Command(BaseCommand):
for work in models.Work.objects.filter(description__contains='{'):
print "updating work %s" % work
bookloader.add_openlibrary(work)
bookloader.add_openlibrary(work, hard_refresh = True)