Ticket #9896 (closed Bug: fixed)

Opened 4 years ago

Last modified 17 months ago

creation date doesn't renew on copy & paste

Reported by: massimo Owned by: davidblewett
Priority: major Milestone: 4.x
Component: General Version: 4.2
Keywords: tuneup Cc:

Description

  • create a page.
  • copy and paste it.
  • check both creation dates: they are exactly the same.

imho, the new one is created when pasted. so that moment should be the date.

this is and issue when you create collections based on creation dates...

obviously this not applies to CUT and paste.

Change History

comment:1 Changed 2 years ago by eleddy

  • Keywords tuneup added
  • Version set to 4.2
  • severity set to Normal
  • Milestone changed from 3.3.x to 4.x

confirmed still existing in 4.2. should be an easy fix for tuneup (see  http://plone.org/documentation/kb/set-creation-date)

comment:2 Changed 2 years ago by afd

From my perspective, it is a problem that can be interpreted in several ways. For example, let's suppose we have a folder of documents, and we make a backup copy of it. For a duplicated document, what is the creation date that is the most relevant? The moment when it was created in the original folder, or when it was copied?

We can have the following fix for this:

from DateTime import DateTime

def handle_object_copied(obj, event):
    """ Update creation date when object duplicated via copy/paste"""
    obj.creation_date = DateTime()

and zcml registration:

<subscriber 
    for="Products.Archetypes.interfaces.IBaseContent zope.lifecycleevent.interfaces.IObjectCopiedEvent"
    handler=".event.handle_object_copied" />
Last edited 2 years ago by afd (previous) (diff)

comment:3 Changed 22 months ago by davisagli

  • Component changed from Infrastructure to General

comment:4 Changed 22 months ago by kleist

  • Status changed from new to confirmed

comment:5 Changed 19 months ago by davidblewett

  • Owner set to davidblewett

comment:6 Changed 17 months ago by do3cc

The current implementation breaks LinguaPlone. LinguaPlone patches the setCreationDate Mutator, it does some things there that require that the object is already added somewhere in a plone site, but this is not the case when the IObjectCopiedEvent is triggered.

comment:8 Changed 17 months ago by maartenkling

  • Status changed from confirmed to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.