You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by rj...@apache.org on 2013/07/04 08:37:54 UTC

svn commit: r1499661 - in /bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets: templates/widget_timeline.html timeline.py

Author: rjollos
Date: Thu Jul  4 06:37:54 2013
New Revision: 1499661

URL: http://svn.apache.org/r1499661
Log:
Reduce number of variables that must exist in context to use the Timeline widget (Refs #461).
 
 The `today` and `yesterday` variables are no longer required. Only the `context` variable is required.

Modified:
    bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html
    bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py

Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html?rev=1499661&r1=1499660&r2=1499661&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html (original)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_timeline.html Thu Jul  4 06:37:54 2013
@@ -21,7 +21,9 @@
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:py="http://genshi.edgewall.org/"
   xmlns:xi="http://www.w3.org/2001/XInclude"
-  py:with="today = format_date(today); yesterday = format_date(yesterday)"
+  py:with="now = datetime.now(req.tz);
+           today = format_date(now);
+           yesterday = format_date(now - timedelta(days=1))"
   py:choose="">
 
   <table py:when="events"

Modified: bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py?rev=1499661&r1=1499660&r2=1499661&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py (original)
+++ bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/timeline.py Thu Jul  4 06:37:54 2013
@@ -213,8 +213,6 @@ class TimelineWidget(WidgetBase):
         else:
             merge_links(srcreq=fakereq, dstreq=req,
                         exclude=["stylesheet", "alternate"])
-            data['today'] = today = datetime.now(req.tz)
-            data['yesterday'] = today - timedelta(days=1)
             if 'context' in data:
                 # Needed for abbreviated messages in widget events (#340)
                 wcontext.set_hints(**(data['context']._hints or {}))