Proposal: "Last modified by"
Dorneles Treméa <deo-+Uw31T5zPiZCkLs28/[email protected]> Thu, 07 Sep 2006 00:49:36 -0300
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Organization | Plone Solutions AS |
| Message-ID | <[email protected]> |
Hey Jonas, folks,
> A Problem with Plone that I'm asked about very often is the lack of a =
> "last modified by" attribute in the plone content types.
yep, very common, indeed.
=
> Since there already is a "Contributors" attribute, it seems straight =
> forward to me that you could insert the names in that field everytime an =
> archetype object is saved. It would be enough with the last person, =
> but you could also make a list, and the last person in that list could =
> be he "last modified by"-person.
> =
> So. Why isn't it so in the current implementation of archetypes? Is it =
> because nobody has thought of it, or is it because there is a problem to =
> this solution ?
What do you guys think about this pretty straight-forward changes to
Archetypes?
Index: Archetypes/ExtensibleMetadata.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Archetypes/ExtensibleMetadata.py (revis=E3o 6655)
+++ Archetypes/ExtensibleMetadata.py (c=F3pia de trabalho)
@@ -116,6 +116,11 @@
description_msgid=3D"help_creators",
i18n_domain=3D"plone"),
),
+ StringField(
+ 'lastEditor',
+ widget=3DStringWidget(
+ visible=3D{'edit':'invisible', 'view':'invisible'}),
+ ),
DateTimeField(
'effectiveDate',
mutator=3D'setEffectiveDate',
@@ -458,7 +463,9 @@
Take appropriate action after the resource has been modified.
For now, change the modification_date.
"""
- # XXX This could also store the id of the user doing modifications.
+ mtool =3D getToolByName(self, 'portal_membership')
+ editor =3D mtool.getAuthenticatedMember().getId()
+ self.setLastEditor(editor)
self.setModificationDate(DateTime())
if shasattr(self, 'http__refreshEtag'):
self.http__refreshEtag()
-- =
_____________________________________________________________________
Dorneles Trem=E9a =B7 Developer =B7 Plone Solutions =B7 Brazil
Consulting =B7 Training =B7 Development =B7 http://www.plonesolutions.com
_____________________________________________________________________
Plone Foundation =B7 http://plone.org/foundation =B7 Protecting Plone
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easi=
er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642