Ignore:
Timestamp:
29 Sep 2014, 05:32:52 (10 years ago)
Author:
Henrik Bettermann
Message:

Hide export download button 24 hours after file generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r11794 r11826  
    216216        status = job.failed and 'FAILED' or status
    217217        start_time = getattr(job, 'begin_after', None)
     218        time_delta = None
    218219        if start_time:
    219             start_time = start_time.astimezone(
    220                 getUtility(
    221                     IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z")
     220            tz = getUtility(IKofaUtils).tzinfo
     221            time_delta = datetime.now(tz) - start_time
     222            start_time = start_time.astimezone(tz).strftime(
     223                "%Y-%m-%d %H:%M:%S %Z")
    222224        download_url = view.url(view.context, 'download_export',
    223225                                data=dict(job_id=job_id))
     226        show_download_button = job.finished and not \
     227                               job.failed and time_delta and \
     228                               time_delta.days < 1
    224229        new_entry = dict(
    225230            job=job_id,
     
    230235            start_time=start_time,
    231236            download_url=download_url,
    232             show_download_button = (job.finished and not job.failed),
     237            show_download_button = show_download_button,
    233238            show_refresh_button = not job.finished,
    234239            show_discard_button = job.finished,)
Note: See TracChangeset for help on using the changeset viewer.