Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#1646 closed defect (fixed)

Attachment date/time shows date/time of server startup

Reported by: PBruin Owned by: Christopher Lenz
Priority: highest Milestone: 0.9
Component: general Version: devel
Severity: blocker Keywords: attachment, wiki
Cc: peter.bruin@…, vyt@… Branch:
Release Notes:
API Changes:
Internal 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 (0)

Change History (8)

comment:1 by PBruin, 19 years ago

Additional info:

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

comment:2 by PBruin, 19 years ago

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 by anonymous, 19 years ago

Priority: lownormal

comment:4 by vyt@…, 19 years ago

Cc: vyt@… added
Component: wikiticket system
Priority: normalhighest
Severity: normalblocker

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 by Christopher Lenz <cmlenz@…>, 19 years ago

Component: ticket systemgeneral
Owner: changed from Jonas Borgström to anonymous
Status: newassigned

comment:6 by Christopher Lenz, 19 years ago

Owner: changed from anonymous to Christopher Lenz
Status: assignednew

comment:7 by Christopher Lenz, 19 years ago

Status: newassigned

comment:8 by Christopher Lenz, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [1828].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.