I have this Folder Structure CPM |-ALLCHANNELS |-PORTALFOLDER |-REFPORTALFOLDER I am trying to copy all the channels contained in the portals anf refportals folders into the allchannels folder. I managed to copy/paste all the channels inside the portals folder with this code of the copypaste function inside the PortalFolder.py: # destination=getattr(self,self.theConfigurationManager.getTheAllChannelsFolder().id ) portalslist = self.getPortals() for pl in portalslist: plchannelslistids =[] print pl.id plchannelslistids = pl.getChannelIds() for c in plchannelslistids: print c if len(plchannelslistids): destination.manage_pasteObjects(pl.manage_copyObjects(plchannelslistids)) else: print "Empty Channels List" plChannelFoldersList=[] plChannelFoldersList = pl.getChannelFolders() for plc in plChannelFoldersList: plchannelslistids=[] plchannelslistids = plc.getChannelIds() print plc.id if len(plChannelFoldersList): destination.manage_pasteObjects(plc.manage_copyObjects(plchannelslistids)) else: print "Empty Channel Folder List" ########## It works fine.It copies all the channels inside the portal folder and pastes them into the allchannels folder. The problem is that when i use the same code for the Refportal folder it fails inside the copysupport.py in the manage_pasteObjects at line 168 id=self._get_id(ob.getId()) because the previous line 167 ob=ob._getCopy(self) returns none as ob def _getCopy(self, container): # Ask an object for a new copy of itself. f=tempfile.TemporaryFile() self._p_jar.exportFile(self._p_oid,f) f.seek(0) ob=container._p_jar.importFile(f) f.close() return ob It throws this error because of the above error. 2002-06-12T15:00:48 PROBLEM(100) Products.CollaboratingPortals.RefPortalFolder 1 Traceback (innermost last): File /home/toolkit/Zope251_bck/lib/python/Products/CollaboratingPortals/RefPortalFolder.py, line 450, in ExportAllChannels (Object: RefPortals) File /home/toolkit/Zope251_bck/lib/python/OFS/CopySupport.py, line 168, in manage_pasteObjects (Object: AllChannels) AttributeError: 'None' object has no attribute 'getId' ###### Any suggestions? Thanks in advance. ____________________________________________________________ Do You Yahoo!? Αποκτήστε τη δωρεάν @yahoo.gr διεύθυνση σας στο http://www.otenet.gr
=?iso-8859-7?Q?George_Stroussopoulos?= writes:
... "manage_pasteObjects" false ... because the previous line 167 ob=ob._getCopy(self) returns none as ob
def _getCopy(self, container): # Ask an object for a new copy of itself. f=tempfile.TemporaryFile() self._p_jar.exportFile(self._p_oid,f) f.seek(0) ob=container._p_jar.importFile(f) f.close() return ob Strange!
Can you check, what object does have this problem? E.g. you can look at "self.getId()", when "ob" is returned as "None". Can you copy/move this object in isolation? Dieter
participants (2)
-
Dieter Maurer -
George Stroussopoulos