changeset 5388:cd96baeeec9b

AttachFile.move_file: send events (so e.g. xapian index update happens)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Dec 2009 22:49:57 +0100
parents 63f2d05c7c20
children 8a9f7b812cce
files MoinMoin/action/AttachFile.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Wed Dec 16 09:58:56 2009 +0100
+++ b/MoinMoin/action/AttachFile.py	Sun Dec 20 22:49:57 2009 +0100
@@ -664,10 +664,14 @@
             return
 
         if new_attachment_path != attachment_path:
-            # move file
+            filesize = os.path.getsize(attachment_path)
             filesys.rename(attachment_path, new_attachment_path)
             _addLogEntry(request, 'ATTDEL', pagename, attachment)
+            event = FileRemovedEvent(request, pagename, attachment, filesize)
+            send_event(event)
             _addLogEntry(request, 'ATTNEW', new_pagename, new_attachment)
+            event = FileAttachedEvent(request, new_pagename, new_attachment, filesize)
+            send_event(event)
             upload_form(pagename, request,
                         msg=_("Attachment '%(pagename)s/%(filename)s' moved to '%(new_pagename)s/%(new_filename)s'.") % {
                             'pagename': pagename,