Permalink
Browse files

simplify the code a little bit

  • Loading branch information...
1 parent aba634d commit c609f171078ef03861ac641590d2abcd50086a23 @Rafiot Rafiot committed Apr 5, 2011
Showing with 6 additions and 4 deletions.
  1. +4 −2 lib/ranking/reports.py
  2. +2 −2 website/master_controler.py
View
@@ -67,10 +67,12 @@ def set_date(self, date):
self.date = date.isoformat()
return self.date
- def set_sources(self, date):
+ def set_sources(self, date = None):
"""
Set the sources paset on a `date`
"""
+ if date is None:
+ date = self.date
self.sources = self.global_db.smembers(\
'{date}{sep}{key}'.format( date = date, \
sep = self.separator,\
@@ -107,7 +109,7 @@ def __init__(self, date, ip_version = 4):
self.last_ranking = None
self.date_raw = date
self.set_date(date)
- self.set_sources(date)
+ self.set_sources()
self.set_dates()
def flush_temp_db(self):
@@ -41,8 +41,8 @@ def set_params(self, date = None):
self.graph_first_date = datetime.date.today() - datetime.timedelta(days=30)
if date is None:
date = self.graph_last_date
- date = self.report.set_date(date)
- self.report.set_sources(date)
+ self.report.set_date(date)
+ self.report.set_sources()
self.report.set_dates()

0 comments on commit c609f17

Please sign in to comment.