コード例 #1
0
ファイル: date_field.py プロジェクト: kranthikumar/muntjac
    def getCalendar(self):
        """Returns new instance calendar used in Date conversions.

        Returns new clone of the calendar object initialized using the the
        current date (if available)

        If this is no calendar is assigned the C{calendar} is used.

        @return: the calendar
        @see: L{setCalendar}
        """
        # Makes sure we have an calendar instance
        if self._calendar is None:
            self._calendar = datetime.now()
        # Clone the instance
        timestamp = totalseconds(self._calendar - datetime(1970, 1, 1))
        newCal = datetime.fromtimestamp(timestamp)

        # Assigns the current time to calendar.
        currentDate = self.getValue()
        if currentDate is not None:
            newCal = currentDate  # FIXME:.setTime(currentDate)

        currentTimeZone = self.getTimeZone()
        if currentTimeZone is not None:
            currentTimeZone  # FIXME: set calendar timezone

        return newCal
コード例 #2
0
ファイル: date_field.py プロジェクト: fbeneventi/muntjac
    def getCalendar(self):
        """Returns new instance calendar used in Date conversions.

        Returns new clone of the calendar object initialized using the the
        current date (if available)

        If this is no calendar is assigned the C{calendar} is used.

        @return: the calendar
        @see: L{setCalendar}
        """
        # Makes sure we have an calendar instance
        if self._calendar is None:
            self._calendar = datetime.now()
        # Clone the instance
        timestamp = totalseconds(self._calendar - datetime(1970, 1, 1))
        newCal = datetime.fromtimestamp(timestamp)

        # Assigns the current time to calendar.
        currentDate = self.getValue()
        if currentDate is not None:
            newCal = currentDate  # FIXME:.setTime(currentDate)

        currentTimeZone = self.getTimeZone()
        if currentTimeZone is not None:
            currentTimeZone  # FIXME: set calendar timezone

        return newCal
コード例 #3
0
 def getMaxInactiveInterval(self, session):
     if session.lifetime is not None:
         return int(totalseconds(session.lifetime))
     else:
         return self._timeout
コード例 #4
0
 def getMaxInactiveInterval(self, session):
     if session.lifetime is not None:
         return int( totalseconds(session.lifetime) )
     else:
         return self._timeout