=== modified file 'twisted/conch/ls.py'
|
|
|
|
| 7 | 7 | |
| 8 | 8 | from time import time, strftime, localtime |
| 9 | 9 | |
| | 10 | # locale-independent month names to use instead of strftime's |
| | 11 | MONTH_NAMES = dict(zip(range(1, 13), |
| | 12 | "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split())) |
| | 13 | |
| 10 | 14 | |
| 11 | 15 | def lsLine(name, s): |
| 12 | 16 | mode = s.st_mode |
| … |
… |
|
| 39 | 43 | if mode&stat.S_ISGID: |
| 40 | 44 | if perms[6] == 'x': perms[6] = 's' |
| 41 | 45 | else: perms[6] = 'S' |
| 42 | | l = perms.tostring() |
| 43 | | l += str(s.st_nlink).rjust(5) + ' ' |
| | 46 | |
| 44 | 47 | un = str(s.st_uid) |
| 45 | | l += un.ljust(9) |
| 46 | 48 | gr = str(s.st_gid) |
| 47 | | l += gr.ljust(9) |
| 48 | 49 | sz = str(s.st_size) |
| 49 | | l += sz.rjust(8) |
| 50 | | l += ' ' |
| 51 | 50 | sixmo = 60 * 60 * 24 * 7 * 26 |
| | 51 | l = [perms.tostring(), str(s.st_nlink).rjust(5), ' ', |
| | 52 | un.ljust(9), gr.ljust(9), sz.rjust(8), ' '] |
| | 53 | |
| | 54 | # need to specify the month manually, as strftime depends on locale |
| | 55 | ttup = localtime(s.st_mtime) |
| 52 | 56 | if s.st_mtime + sixmo < time(): # last edited more than 6mo ago |
| 53 | | l += strftime("%b %d %Y ", localtime(s.st_mtime)) |
| | 57 | strtime = strftime("%%s %d %Y ", ttup) |
| 54 | 58 | else: |
| 55 | | l += strftime("%b %d %H:%M ", localtime(s.st_mtime)) |
| 56 | | l += name |
| 57 | | return l |
| | 59 | strtime = strftime("%%s %d %H:%M ", ttup) |
| | 60 | l.append(strtime % (MONTH_NAMES[ttup[1]],)) |
| | 61 | |
| | 62 | l.append(name) |
| | 63 | return ''.join(l) |
| 58 | 64 | |
| 59 | 65 | |
| 60 | 66 | __all__ = ['lsLine'] |
=== modified file 'twisted/mail/imap4.py'
|
|
|
|
| 49 | 49 | import twisted.cred.credentials |
| 50 | 50 | |
| 51 | 51 | |
| | 52 | # locale-independent month names to use instead of strftime's |
| | 53 | MONTH_NAMES = dict(zip(range(1, 13), |
| | 54 | "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split())) |
| 52 | 55 | |
| 53 | 56 | class MessageSet(object): |
| 54 | 57 | """ |
| … |
… |
|
| 1904 | 1907 | log.msg("%d:%r: unpareseable internaldate: %r" % (id, msg, idate)) |
| 1905 | 1908 | raise IMAP4Exception("Internal failure generating INTERNALDATE") |
| 1906 | 1909 | |
| 1907 | | odate = time.strftime("%d-%b-%Y %H:%M:%S ", ttup[:9]) |
| | 1910 | # need to specify the month manually, as strftime depends on locale |
| | 1911 | strdate = time.strftime("%d-%%s-%Y %H:%M:%S ", ttup[:9]) |
| | 1912 | odate = strdate % (MONTH_NAMES[ttup[1]],) |
| 1908 | 1913 | if ttup[9] is None: |
| 1909 | 1914 | odate = odate + "+0000" |
| 1910 | 1915 | else: |