diff MoinMoin/action/AttachFile.py @ 1864:2b24220424fa

AttachFile: also show file mtime in attachment list
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 09 Mar 2007 00:48:20 +0100
parents af0feb0e3c7b
children 0194beaf511e
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Fri Mar 09 00:04:57 2007 +0100
+++ b/MoinMoin/action/AttachFile.py	Fri Mar 09 00:48:20 2007 +0100
@@ -293,8 +293,9 @@
         label_install = _("install")
 
         for file in files:
-            fsize = float(os.stat(os.path.join(attach_dir, file).encode(config.charset))[6]) # in byte
-            fsize = "%.1f" % (fsize / 1024)
+            st = os.stat(os.path.join(attach_dir, file).encode(config.charset))
+            fsize = "%.1f" % (float(st.st_size) / 1024)
+            fmtime = request.user.getFormattedDateTime(st.st_mtime)
             baseurl = request.getScriptname()
             action = action_name
             urlpagename = wikiutil.quoteWikinameURL(pagename)
@@ -312,6 +313,7 @@
                         'get_url': get_url, 'label_get': label_get,
                         'file': wikiutil.escape(file).replace(' ', '%20'),
                         'fsize': fsize,
+                        'fmtime': fmtime,
                         'pagename': pagename}
 
             del_link = ''
@@ -342,7 +344,7 @@
             parmdict['move_link'] = move_link
             str = str + ('<li>[%(del_link)s%(move_link)s'
                 '<a href="%(get_url)s">%(label_get)s</a>&nbsp;| %(viewlink)s]'
-                ' (%(fsize)s KB) attachment:<strong>%(file)s</strong></li>') % parmdict
+                ' (%(fmtime)s, %(fsize)s KB) attachment:<strong>%(file)s</strong></li>') % parmdict
         str = str + "</ul>"
     else:
         if showheader: