Re: [Zope] Touching an object / updating the modification time

2009-03-30 Thread Paul Winkler
On Sat, Mar 28, 2009 at 01:02:58PM +0100, Jakob Schou Jensen wrote:
 Hi Paul,
 
 Doing a
 
some_image._p_changed = 1
 
 gives me an error:
 
_p_changed is an invalid attribute name because it starts with _.
 
 Do you know what I am doing wrong?

Ah, I didn't realize you are doing this in untrusted code.
http://docs.zope.org/zope2/zope2book/source/ScriptingZope.html#script-security

Another approach would be to just change any (small) attribute of the
object.  Something like: some_image.title = some_image.title


-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Touching an object / updating the modification time

2009-03-27 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 27.03.2009 7:40 Uhr, Jakob Schou Jensen wrote:
 Is it possible to update the modification time of an object (in this
 case an Image object)?
 
 

The modification date is stored as 'bobobase_modification_date'
attribute (DateTime instance).

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAknMzCIACgkQCJIWIbr9KYzEFQCfYrrEmUNzxKorC5UIPopH7eQo
XJYAn1YM/y31UbmBFmC3Fa+KbXRviP1m
=iwKW
-END PGP SIGNATURE-
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:i...@zopyx.com
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Touching an object / updating the modification time

2009-03-27 Thread Paul Winkler
On Fri, Mar 27, 2009 at 07:53:33AM -0500, Andreas Jung wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 27.03.2009 7:40 Uhr, Jakob Schou Jensen wrote:
  Is it possible to update the modification time of an object (in this
  case an Image object)?
  
  
 
 The modification date is stored as 'bobobase_modification_date'
 attribute (DateTime instance).

Note though that you can't set it to an arbitrary value, because the
ZODB will set it to the current time when the transaction commits.

If that's all you want, it's sufficient to do something like:

some_image._p_changed = 1

(and then, if you're running in eg. a zopectl debug prompt, import
transaction; transaction.commit())

-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )