Ejemplo n.º 1
0
 def network_setup(self):
     dict = {}
     self.net_mtime = self.network_connect()
     if self.net_mtime != None:
         if os.path.exists( self.user_data_file ):
             self.network_update()
             local_mtime = int(os.stat( self.user_data_file ).st_mtime)
             if local_mtime > self.net_mtime:
                 self.network_upload()
             elif local_mtime < self.net_mtime:
                 self.network_download()
         else:
             self.network_download()
     if os.path.exists( self.user_data_file ):
         ph = open( self.user_data_file )
         dict = Unpickler( ph ).load()[-1]
     if not os.path.exists( self.user_data_file ) and self.net_mtime == None:
         ph = open( self.user_data_file, 'w+' )
         Pickler( ph ).dump( dict )
         ph.close()
         os.utime( self.user_data_file, (0,0) )
     last_month = dateDelta( date.today() ).get_last_month()
     keys = dict.keys()
     keys.sort()
     for key in keys:
         if key[:7] < '%0.4d-%0.2d' % (last_month.year,last_month.month):
             dict.pop( key )
         else:
             break
     self.freetime.update( dict )
Ejemplo n.º 2
0
 def set_month(self, date):
     self.firstweekday = dateDelta( date ).get_first_day().weekday()
     self.last_day = dateDelta( date ).get_last_day().day
     self.last_day_previous_month = dateDelta( dateDelta( date ).get_last_month() ).get_last_day().day
     self.last_day_next_month = dateDelta( dateDelta( date ).get_next_month() ).get_last_day().day
     self.key_engine = keyEngine( date )
     self.key_engine_prev = keyEngine( dateDelta( date ).get_last_month() )
Ejemplo n.º 3
0
    def __init__(self, date):
        year = date.year
        month = date.month

        prev = dateDelta( date ).get_last_month()
        year_prev = prev.year
        month_prev = prev.month
        self.base_template = '%0.4d-%0.2d' % (year,month)
        self.prev_template = '%0.4d-%0.2d' % (year_prev,month_prev)