Ticket #9896 (closed Bug: fixed)

Opened 5 years ago

Last modified 11 months ago

creation date doesn't renew on copy & paste

Reported by: massimo Owned by: davidblewett
Priority: major Milestone: 4.x
Component: Archetypes Version: 4.3
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 3 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 3 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 3 years ago by afd (previous) (diff)

comment:3 Changed 3 years ago by davisagli

  • Component changed from Infrastructure to General

comment:4 Changed 3 years ago by kleist

  • Status changed from new to confirmed

comment:5 Changed 3 years ago by davidblewett

  • Owner set to davidblewett

comment:6 Changed 2 years 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 2 years ago by maartenkling

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

comment:9 Changed 12 months ago by yulka

  • Status changed from closed to reopened
  • Version changed from 4.2 to 4.3
  • Resolution fixed deleted

comment:10 Changed 12 months ago by yulka

Although the commit by do3cc updates CreationDate on pasted objects (and their children), those do not get reindexed so folder_contents and byliner still show the original metadata (until those pasted objects get edited or catalog indexes updated).

This inconsistency still exists in the newest plone 4.3.3 (products.archetypes 1.9.7)

comment:11 Changed 12 months ago by yulka

  • Component changed from General to Archetypes

comment:13 Changed 11 months ago by jensens

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