Beispiel #1
0
 def decodeDatePeriod(self, datestr, workdate=None, locale=None,min_date=None,max_date=None):
     """TODO
     
     :param datestr: a date string. For the string format, please check the :meth:`decodeDatePeriod()
     <gnr.core.gnrdate.decodeDatePeriod>` method docstrings
     :param workdate: the :ref:`workdate`
     :param locale: the current locale (e.g: en, en_us, it)"""
     workdate = workdate or self.workdate
     locale = locale or self.locale
     period = datestr
     valid = False
     try:
         returnDate = gnrdate.decodeDatePeriod(datestr, workdate=workdate, locale=locale, returnDate=True,min_date=min_date,max_date=max_date)
         valid = True
     except:
         returnDate = (None, None)
         period = None
     result = Bag()
     result['from'] = returnDate[0]
     result['to'] = returnDate[1]
     result['prev_from'] = gnrdate.dateLastYear(returnDate[0])
     result['prev_to'] = gnrdate.dateLastYear(returnDate[1])
     result['period'] = period
     result['valid'] = valid
     result['period_string'] = gnrdate.periodCaption(locale=locale, *returnDate)
     return result
Beispiel #2
0
 def rpc_decodeDatePeriod(self, datestr, workdate=None, locale=None):
     """add???
     
     :param datestr: add???
     :param workdate: add???. Default value is ``None``
     :param locale: add???. Default value is ``None``
     :returns: add???
     """
     workdate = workdate or self.workdate
     locale = locale or self.locale
     period = datestr
     valid = False
     try:
         returnDate = gnrdate.decodeDatePeriod(datestr,
                                               workdate=workdate,
                                               locale=locale,
                                               returnDate=True)
         valid = True
     except:
         returnDate = (None, None)
         period = None
     result = Bag()
     result['from'] = returnDate[0]
     result['to'] = returnDate[1]
     result['prev_from'] = gnrdate.dateLastYear(returnDate[0])
     result['prev_to'] = gnrdate.dateLastYear(returnDate[1])
     result['period'] = period
     result['valid'] = valid
     result['period_string'] = gnrdate.periodCaption(locale=locale,
                                                     *returnDate)
     return result
Beispiel #3
0
 def rpc_decodeDatePeriod(self, datestr, workdate=None, locale=None):
     """add???
     
     :param datestr: add???
     :param workdate: add???. Default value is ``None``
     :param locale: add???. Default value is ``None``
     :returns: add???
     """
     workdate = workdate or self.workdate
     locale = locale or self.locale
     period = datestr
     valid = False
     try:
         returnDate = gnrdate.decodeDatePeriod(datestr, workdate=workdate, locale=locale, returnDate=True)
         valid = True
     except:
         returnDate = (None, None)
         period = None
     result = Bag()
     result['from'] = returnDate[0]
     result['to'] = returnDate[1]
     result['prev_from'] = gnrdate.dateLastYear(returnDate[0])
     result['prev_to'] = gnrdate.dateLastYear(returnDate[1])
     result['period'] = period
     result['valid'] = valid
     result['period_string'] = gnrdate.periodCaption(locale=locale, *returnDate)
     return result
Beispiel #4
0
 def decodeDatePeriod(self, datestr, workdate=None, locale=None):
     """TODO
     
     :param datestr: a date string. For the string format, please check the :meth:`decodeDatePeriod()
     <gnr.core.gnrdate.decodeDatePeriod>` method docstrings
     :param workdate: the :ref:`workdate`
     :param locale: the current locale (e.g: en, en_us, it)"""
     workdate = workdate or self.workdate
     locale = locale or self.locale
     period = datestr
     valid = False
     try:
         returnDate = gnrdate.decodeDatePeriod(datestr,
                                               workdate=workdate,
                                               locale=locale,
                                               returnDate=True)
         valid = True
     except:
         returnDate = (None, None)
         period = None
     result = Bag()
     result['from'] = returnDate[0]
     result['to'] = returnDate[1]
     result['prev_from'] = gnrdate.dateLastYear(returnDate[0])
     result['prev_to'] = gnrdate.dateLastYear(returnDate[1])
     result['period'] = period
     result['valid'] = valid
     result['period_string'] = gnrdate.periodCaption(locale=locale,
                                                     *returnDate)
     return result