import logging

log = logging.getLogger(__name__)

__all__ = ['ExpressionBase','ExpressionAbs','ExpressionTime','ExpressionField']

class ExpressionBase(object):
	'''
		Base Class for expressions
	'''

	def __init__(self):
		super(ExpressionBase,self).__init__()

	def todict(self):
		'''
			to_dict must return a dict with all attributes
		'''
		raise NotImplementedError

class ExpressionAbs(ExpressionBase):
	'''
		Class for absolute expression
	'''

	def __init__(self):
		super(ExpressionAbs,self).__init__()

	def todict(self):
		'''
			Absolute expressions have no attributes
		'''
		return {}

class ExpressionTime(ExpressionBase):
	'''
		Class for Time expressions
	'''

	def __init__(self,wday,hour):
		super(ExpressionTime,self).__init__()
		self.wday = wday
		self.hour = hour
		
	def todict(self):
		'''
			Return a dict with wday and hour
		'''
		return {'wday' : self.wday , 'hour' : self.hour }

class ExpressionField(ExpressionBase):
	'''
		Field expressions Class
	'''

	def __init__(self,field,exp):
		super(ExpressionField,self).__init__()
		self.field = field
		self.exp = exp


	def todict(self):
		'''
			Return a dict with field and expression
		'''
		return {'field' : self.field , 'expression' : self.exp}

	
@@ -155,23 +155,32 @@
 bject):%0A
-%09'''%0A%09%09
+    '''%0A        
 Base Cla
@@ -190,39 +190,45 @@
 for expressions%0A
-%09
+    
 '''%0A%0A
-%09
+    
 def __init__(sel
@@ -223,34 +223,40 @@
 __init__(self):%0A
-%09%09
+        
 super(Expression
@@ -270,33 +270,36 @@
 lf).__init__()%0A%0A
-%09
+    
 def todict(self)
@@ -300,25 +300,40 @@
 (self):%0A
-%09%09'''%0A%09%09%09
+        '''%0A            
 to_dict 
@@ -371,24 +371,36 @@
 ributes%0A
-%09%09'''%0A%09%09
+        '''%0A        
 raise No
@@ -447,39 +447,48 @@
 xpressionBase):%0A
-%09'''%0A%09%09
+    '''%0A        
 Class for absolu
@@ -501,23 +501,29 @@
 ression%0A
-%09
+    
 '''%0A%0A
-%09
+    
 def __in
@@ -534,18 +534,24 @@
 (self):%0A
-%09%09
+        
 super(Ex
@@ -580,17 +580,20 @@
 it__()%0A%0A
-%09
+    
 def todi
@@ -602,25 +602,40 @@
 (self):%0A
-%09%09'''%0A%09%09%09
+        '''%0A            
 Absolute
@@ -666,24 +666,36 @@
 ributes%0A
-%09%09'''%0A%09%09
+        '''%0A        
 return %7B
@@ -735,23 +735,32 @@
 nBase):%0A
-%09'''%0A%09%09
+    '''%0A        
 Class fo
@@ -778,23 +778,29 @@
 essions%0A
-%09
+    
 '''%0A%0A
-%09
+    
 def __in
@@ -818,17 +818,22 @@
 day,
-hour):%0A%09%09
+tod):%0A        
 supe
@@ -862,26 +862,32 @@
 .__init__()%0A
-%09%09
+        
 self.wday = 
@@ -895,99 +895,146 @@
 day%0A
-%09%09self.hour = hour%0A%09%09%0A%09def todict(self):%0A%09%09'''%0A%09%09%09Return a dict with wday and hour%0A%09%09'''%0A%09%09
+        self.tod = tod%0A        %0A    def todict(self):%0A        '''%0A            Return a dict with wday and time-of-day%0A        '''%0A        
 retu
@@ -1059,20 +1059,27 @@
 wday , '
-hour
+time-of-day
 ' : self
@@ -1083,12 +1083,11 @@
 elf.
-hour
+tod
  %7D%0A%0A
@@ -1125,23 +1125,32 @@
 nBase):%0A
-%09'''%0A%09%09
+    '''%0A        
 Field ex
@@ -1169,15 +1169,21 @@
 ass%0A
-%09
+    
 '''%0A%0A
-%09
+    
 def 
@@ -1208,18 +1208,24 @@
 d,exp):%0A
-%09%09
+        
 super(Ex
@@ -1255,18 +1255,24 @@
 nit__()%0A
-%09%09
+        
 self.fie
@@ -1282,18 +1282,24 @@
 = field%0A
-%09%09
+        
 self.exp
@@ -1307,17 +1307,20 @@
 = exp%0A%0A%0A
-%09
+    
 def todi
@@ -1333,17 +1333,32 @@
 f):%0A
-%09%09'''%0A%09%09%09
+        '''%0A            
 Retu
@@ -1397,16 +1397,28 @@
 ion%0A
-%09%09'''%0A%09%09
+        '''%0A        
 retu
@@ -1474,5 +1474,8 @@
 p%7D%0A%0A
-%09
+    

Use time-of-day expression instead of hour on ExpressionTime