handlers.py
changeset 78 85345abbd46a
parent 77 4287fb77e312
child 79 43ac75054d5c
equal deleted inserted replaced
77:4287fb77e312 78:85345abbd46a
    85         channel         = channel,
    85         channel         = channel,
    86         count           = count,
    86         count           = count,
    87         lines           = lines,
    87         lines           = lines,
    88     )
    88     )
    89 
    89 
    90 @preferences.handler(prefs.formatter, prefs.timezone)
    90 @preferences.handler(prefs.formatter, prefs.timezone, prefs.count)
    91 def channel_link (request, channel, timestamp, formatter, timezone) :
    91 def channel_link (request, channel, timestamp, formatter, timezone, count) :
    92     """
    92     """
    93         Display channel_date for specific UTC timestamp
    93         Display channel_date for specific UTC timestamp
    94     """
    94     """
    95 
    95 
    96     # convert timestamp to user's timezone
    96     # convert timestamp to user's timezone
    97     timestamp = timestamp.astimezone(timezone)
    97     timestamp = timestamp.astimezone(timezone)
    98 
    98 
    99     # get latest events
    99     # get correct day's correct page of lines
   100     lines = channel.source.get_date(timestamp)
   100     page, max, lines = channel.source.get_date_paged(timestamp, count)
   101 
   101 
   102     # lines
   102     # lines
   103     lines = formatter.format_html(lines)
   103     lines = formatter.format_html(lines)
   104 
   104 
   105     # render
   105     # render
   106     return templates.render_to_response("channel_date",
   106     return templates.render_to_response("channel_date",
   107         req             = request,
   107         req             = request,
   108         prefs           = request.prefs,
   108         prefs           = request.prefs,
   109         channel         = channel,
   109         channel         = channel,
   110         date            = timestamp,
   110         date            = timestamp,
       
   111         page            = page,
       
   112         count           = count,
       
   113         max             = max,
   111         lines           = lines,
   114         lines           = lines,
   112     )
   115     )
   113 
   116 
   114 @preferences.handler(prefs.timezone)
   117 @preferences.handler(prefs.timezone)
   115 def channel_calendar (request, channel, year, month, timezone) :
   118 def channel_calendar (request, channel, year, month, timezone) :
   147     """
   150     """
   148 
   151 
   149     # fix date timezone
   152     # fix date timezone
   150     date = date.replace(tzinfo=timezone)
   153     date = date.replace(tzinfo=timezone)
   151 
   154 
   152     # get latest events
   155     # get that day's events, either paged or not
   153     if page :
   156     if page :
   154         page, max, lines = channel.source.get_date_paged(date, count, page)
   157         page, max, lines = channel.source.get_date_paged(date, count, page)
   155         
   158         
   156     else :
   159     else :
   157         lines = channel.source.get_date(date)
   160         lines = channel.source.get_date(date)