[Zope] manage_copyObject [Continue]

George Stroussopoulos strusos@yahoo.com
Tue, 11 Jun 2002 15:57:42 +0100 (BST)


The problem is inside the manage_copyObjects function
I modified it only to see where it fails ( i just
inserted a try ).

########################################################3
   def 
manage_copyObjects(self, ids=None, REQUEST=None,
RESPONSE=None):
        """Put a reference to the objects named in ids
in the clip 
board"""
        if ids is None and REQUEST is not None:
            return eNoItemsSpecified
        elif ids is None:
            raise ValueError, 'ids must be specified'

        if type(ids) is type(''):
            ids=[ids]
        oblist=[]
                for id in ids:
	            
	            try:
		    	ob=self._getOb(id)#HERE IS THE PROBLEM
		    	print ob		    	    	
		        if not ob.cb_isCopyable():
		        	print "Copy Error, not copyable"
		                raise CopyError, eNotSupported % id
		        m=Moniker.Moniker(ob)
		        oblist.append(m.dump())
		    except:
		    	logExc(__name__, WARNING, 'Error  ' + id , 
RERAISE )
		
        cp=(0, oblist)
        cp=_cb_encode(cp)
        if REQUEST is not None:
            resp=REQUEST['RESPONSE']
            resp.setCookie('__cp', cp, path='%s' %
cookie_path
(REQUEST))
            REQUEST['__cp'] = cp
            return self.manage_main(self, REQUEST)
        return cp
##############################
and inside the objectmanager in the _getOb function

    def _getOb(self, id, default=_marker):
        # FIXME: what we really need to do here is
ensure that only
        # sub-items are returned. That could have a
measurable hit
        # on performance as things are currently
implemented, so for
        # the moment we just make sure not to expose
private attrs.
        if id[:1] != '_' and hasattr(aq_base(self),
id):
            return getattr(self, id)
        if default is _marker:
            raise AttributeError, id
        return default
######################
For some reason i ignore for the moment, it fails
during 
the  _getOb() function.

Any ideas?

###
Would it be better to use manage_clone?

--- In zope@y..., George Stroussopoulos <strusos@y...>
wrote:
> I am trying to copy/paste some Channels from my
> portals folder to a different folder named
> allchannels.
> I will do the same for other folders containig
> channels
>  in order to have a folder containig all the
channels.
> The code i use is :
> 
>
channelIDs=self.theConfigurationManager.getThePortalsFolder
().getAllChannelIds()
> copydata =
> self.theConfigurationManager.getThePortalsFolder
().manage_copyObjects(channelIDs)
> self.manage_pasteObjects(copydata)
> 
> It raises the following
> 2002-06-11T12:03:25 PROBLEM(100) OFS.CopySupport
Error
>  Information.xml
> 1Traceback (innermost last):
>   File
>
/home/toolkit/Zope251_bck/lib/python/OFS/CopySupport.py,
> line 97, in manage_copyObjects
>     (Object: Portals)
>   File
>
/home/toolkit/Zope251_bck/lib/python/OFS/ObjectManager.py,
> line 233, in _getOb
>     (Object: Portals)
> AttributeError: Information.xml
> 
> ################################
> I use Zope 2.5.1 linux version.
> I use the product CollaboratingPortals by Thrasys
> which i am trying to extend it.
> 


____________________________________________________________
Do You Yahoo!?
Αποκτήστε τη δωρεάν @yahoo.gr διεύθυνση σας στο http://www.otenet.gr