예제 #1
0
def formatdate(timeval=None):
    if timeval is None:
        timeval = timelib.now()
    timeval = timelib.gmtime(timeval)
    return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
            ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][timeval[6]],
            timeval[2],
            ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][timeval[1]-1],
                                timeval[0], timeval[3], timeval[4], timeval[5])
예제 #2
0
def formatdate(timeval=None):
    if timeval is None:
        timeval = timelib.now()
    timeval = timelib.gmtime(timeval)
    return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
            ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][timeval[6]],
            timeval[2],
            ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][timeval[1]-1],
                                timeval[0], timeval[3], timeval[4], timeval[5])
예제 #3
0
 def get_setstring(self):
     s = []
     s.append("%s=%s" % (self.name, self.value))
     if self.comment:
         s.append("comment=%s" % httpquote(self.comment))
     if self.domain:
         s.append("domain=%s" % httpquote(self.domain))
     if self.max_age:
         s.append("max_age=%s" % httpquote(self.max_age))
     if self.path:
         s.append("path=%s" % httpquote(self.path))
     if self.secure:
         s.append("secure")
     if self.version:
         s.append("version=%s" % httpquote(str(self.version)))
     if self.expires:
         s.append("expires=%s" % timelib.strftime(
             "%a, %d-%b-%Y %H:%M:%S GMT", timelib.gmtime(self.expires)))
     return "; ".join(s)
예제 #4
0
파일: rfc2822.py 프로젝트: kdart/pycopia3
def formatdate(timeval=None):
    """Returns time format preferred for Internet standards.

    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123

    According to RFC 1123, day and month names must always be in
    English.  If not for that, this code could use strftime().  It
    can't because strftime() honors the locale and could generated
    non-English names.
    """
    from pycopia import timelib
    if timeval is None:
        timeval = timelib.time()
    timeval = timelib.gmtime(timeval)
    return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
            ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][timeval[6]],
            timeval[2],
            ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][timeval[1]-1],
                                timeval[0], timeval[3], timeval[4], timeval[5])
예제 #5
0
def formatdate(timeval=None):
    """Returns time format preferred for Internet standards.

    Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123

    According to RFC 1123, day and month names must always be in
    English.  If not for that, this code could use strftime().  It
    can't because strftime() honors the locale and could generated
    non-English names.
    """
    from pycopia import timelib
    if timeval is None:
        timeval = timelib.time()
    timeval = timelib.gmtime(timeval)
    return "%s, %02d %s %04d %02d:%02d:%02d GMT" % ([
        "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
    ][timeval[6]], timeval[2], [
        "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
        "Nov", "Dec"
    ][timeval[1] - 1], timeval[0], timeval[3], timeval[4], timeval[5])
예제 #6
0
 def from_float(cls, timeval):
     return cls(_value=timelib.gmtime(timeval))
예제 #7
0
 def now(cls):
     return cls(_value=timelib.gmtime())
예제 #8
0
파일: httputils.py 프로젝트: kdart/pycopia3
 def from_float(cls, timeval):
     return cls(_value=timelib.gmtime(timeval))
예제 #9
0
파일: httputils.py 프로젝트: kdart/pycopia3
 def now(cls):
     return cls(_value=timelib.gmtime())