remove aquisition wrapper in ZMS

Tobias Greitzke <[email protected]> Sat, 16 Jan 2010 14:36:24 +0100
Newsgroups gmane.comp.cms.zms.devel
Organization tog.is information design
Message-ID <[email protected]>
Dear ZMS-Developers,

I'm currently developing a ZMS-MediaDB where media files are stored in a 
central media folder. Images are then no longer stored in place in the 
content, they're linked into the content from the mediaDB. Right now you 
have to upload all the files to the mnediadb first before you can link 
them into the content. For convenience reasons we now want to upload the 
files to the mediadb "on the fly", move the file to the mediaDB in the 
background and then link it back into the place where you want to use 
it. Everything works fine so far, the problem occurs when I try to 
delete the uploaded file attribute in place after creating the new 
object in the mediaDB.

Here the code that moves the files in onChangeObjEvt:

<dtml-call 
"REQUEST.set('ref',content.mediadb._manage_addZMSCustom('ZMSGraphic',{'img':getObjProperty('attr_bild',REQUEST)},REQUEST))">

<dtml-call "setObjStateModified(REQUEST)">
<dtml-call "setObjProperty('attr_bildref','{$mediadb/'+ref.id+'}',lang)">
<dtml-call "setObjProperty('attr_bild',None,lang)">


So far I could figure out what causes the problem:
When you acquire an object to access the attributes, Zope puts the 
object into an acquisition wrapper. I found an examples how the get 
arround the problem with an external method but couldn't transfer the 
solution to ZMS.

def moveObject(id, fromFolder, toFolder):
	object = fromFolder[id]
	toFolder._setObject(id, object.aq_base)
	fromFolder.manage_delObjects([id])


What makes the difference is the attribute aq_base which removes the 
wrapper from the acquired object and therefore you can delete it.

http://docs.zope.org/zope2/zdgbook/Acquisition.html#acquisition-and-methods


My question now is how I can do that in ZMS?


Currently using:
ZMS2 2.12.1-06 (Build #132e) Zope 2.11.1, python 2.4.5, linux



Thanks for your input
Tobias Greitzke




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/zms-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/zms-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/