Пример #1
0
 def get_quota(self):
     """ If quota active, return check-function, hour, minute """
     if self.have_quota:
         self.q_period = cfg.quota_period()[0].lower()
         self.q_day = 1
         self.q_hour = self.q_minute = 0
         txt = cfg.quota_day().lower()
         m = self.__re_day.search(txt)
         if m:
             self.q_day = int(m.group(1))
         m = self.__re_hm.search(txt)
         if m:
             self.q_hour = int(m.group(1))
             self.q_minute = int(m.group(2))
         if self.q_period == "w":
             self.q_day = max(1, self.q_day)
             self.q_day = min(7, self.q_day)
         elif self.q_period == "m":
             self.q_day = max(1, self.q_day)
             self.q_day = min(31, self.q_day)
         else:
             self.q_day = 1
         self.change_quota(allow_resume=False)
         return quota_handler, self.q_hour, self.q_minute
     else:
         return None, 0, 0
Пример #2
0
 def get_quota(self):
     """ If quota active, return check-function, hour, minute """
     if self.have_quota:
         self.q_period = cfg.quota_period()[0].lower()
         self.q_day = 1
         self.q_hour = self.q_minute = 0
         txt = cfg.quota_day().lower()
         m = self.__re_day.search(txt)
         if m:
             self.q_day = int(m.group(1))
         m = self.__re_hm.search(txt)
         if m:
             self.q_hour = int(m.group(1))
             self.q_minute = int(m.group(2))
         if self.q_period == 'w':
             self.q_day = max(1, self.q_day)
             self.q_day = min(7, self.q_day)
         elif self.q_period == 'm':
             self.q_day = max(1, self.q_day)
             self.q_day = min(31, self.q_day)
         else:
             self.q_day = 1
         self.change_quota(allow_resume=False)
         return quota_handler, self.q_hour, self.q_minute
     else:
         return None, 0, 0
Пример #3
0
 def get_quota(self):
     """ If quota active, return check-function, hour, minute """
     if self.have_quota:
         self.q_period = cfg.quota_period()[0].lower()
         self.q_day = 1
         self.q_hour = self.q_minute = 0
         # Pattern = <day#> <hh:mm>
         # The <day> and <hh:mm> part can both be optional
         txt = cfg.quota_day().lower()
         m = RE_DAY.search(txt)
         if m:
             self.q_day = int(m.group(1))
         m = RE_HHMM.search(txt)
         if m:
             self.q_hour = int(m.group(1))
             self.q_minute = int(m.group(2))
         if self.q_period == "w":
             self.q_day = max(1, self.q_day)
             self.q_day = min(7, self.q_day)
         elif self.q_period == "m":
             self.q_day = max(1, self.q_day)
             self.q_day = min(31, self.q_day)
         else:
             self.q_day = 1
         self.change_quota(allow_resume=False)
         return quota_handler, self.q_hour, self.q_minute
     else:
         return None, 0, 0