Edgewall Software
Modify

Ticket #1646 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

Attachment date/time shows date/time of server startup

Reported by: PBruin Owned by: cmlenz
Priority: highest Milestone: 0.9
Component: general Version: devel
Severity: blocker Keywords: attachment, wiki
Cc: peter.bruin@…, vyt@…
Release Notes:
API Changes:

Description

When attaching a file to a wiki the date/time shown next to the attachment shows date/time that is related to the last server restart and not the actual upload date/time.
I am using r1768 with mod_python.

Attachments

Change History

comment:1 Changed 7 years ago by PBruin

Additional info:

  • 14-May was still ok, all attachments have different time
  • 16-May not ok, multiple attachments with same date/time

comment:2 Changed 7 years ago by PBruin

I guess my memory is short. I saw that I reported a simular issue in #1563 that was fixed in [1682]. This made it easy for me to find the problem for this ticket. This patch works for me.

Index: attachment.py
===================================================================
--- attachment.py	(revision 1768)
+++ attachment.py	(working copy)
@@ -106,20 +106,23 @@
         if handle_ta:
             db.commit()
 
-    def insert(self, filename, fileobj, size, time=time.time(), db=None):
+    def insert(self, filename, fileobj, size, t=None, db=None):
         if not db:
             db = self.env.get_db_cnx()
             handle_ta = True
         else:
             handle_ta = False
 
+        if t is None:
+           t = time.time()
+
         # Maximum attachment size (in bytes)
         max_size = int(self.env.config.get('attachment', 'max_size'))
         if max_size >= 0 and size > max_size:
             raise TracError('Maximum attachment size: %d bytes' % max_size,
                             'Upload failed')
         self.size = size
-        self.time = time
+        self.time = t
 
         if not os.access(self.path, os.F_OK):
             os.makedirs(self.path)

comment:3 Changed 7 years ago by anonymous

  • Priority changed from low to normal

comment:4 Changed 7 years ago by vyt@…

  • Cc vyt@… added
  • Component changed from wiki to ticket system
  • Priority changed from normal to highest
  • Severity changed from normal to blocker

Peter, thank you very much. I check you patch, it works fine.
But only for new attachments... how many attachments with wrong time... grrr

comment:5 Changed 7 years ago by Christopher Lenz <cmlenz@…>

  • Component changed from ticket system to general
  • Owner changed from jonas to anonymous
  • Status changed from new to assigned

comment:6 Changed 7 years ago by cmlenz

  • Owner changed from anonymous to cmlenz
  • Status changed from assigned to new

comment:7 Changed 7 years ago by cmlenz

  • Status changed from new to assigned

comment:8 Changed 7 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [1828].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cmlenz. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.