[Zope-dev] Refernecing a zope page template's id ad title from a python script.
Hi, I have a breadcrumbs python filesystem script. It's a long script that constructs dictionaries and places them in a list for a master_template to display. The dictionaries look like this relative = context.portal_url.getRelativeContentPath(context) code for various things ... ordinaryUrl = portal_url + '/' + join (relative, '/') ordinaryId = relative[-1] ordinaryD = { 'id': ordinaryId , 'title' : obj.title_or_id() , 'url' : ordinaryUrl} In some cases I need to get an id for a zope page template instead of for 'context'. Can anybody tell me how to do that, or better yet tell me where the way to do it is documented? I haven't had much luck searching the source code for something that'll help. cheers, Phil ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: data migration from zope 2.6.1 to zope 2.7.0-b2
Paul Winkler wrote: On Fri, Feb 06, 2004 at 03:12:39PM -0600, J Cameron Cooper wrote: altkey wrote: I am fairly new to zope python but I am working to migrate some data/objects from zope 2.6.1 to zope 2.7.0-b2 (and eventually 2.7.0 final. What I am doing is this. (1) get Dublin core metadata + some Dublin core extensions for the objects (2) get pure text representation of object content - I can't use a simple import/export in zexp format because the classes in the receiving zope instance differ significantly from the classes in the sending zope instance. I am able to collect all the data mentioned above and pass it across to the new 2.7.0-b2 zope instance but i am having trouble getting my objects to live where they need to live; specifically their path is not being accepted properly when i recreate the objects. Before trying to deal with the problem you state, I'll make two possibly simplifying observations: 1. There should be no need to do any migration when upgrading Zope. The ZODB has not changed, and you may simply copy it over or upgrade Zope in place. 2. ZSyncer is the best magic for copying objects from one instance to another. I doubt it will help. ZSyncer is a shortcut for export - import, and altkey wants to convert between two different classes. Also zsyncer currently enforces (stupidly) that the two zopes must have the same folder hierarchy - you can't sync /foo/bar/baz to /bat/bar/baz. altkey, maybe you should break this into multiple steps, some of which are apparently done already; something like: 1) write code that extracts data from an old class. 2) write code that creates an instance of the new class from this data. note that this is on one server so the classes must have different names or live in different modules. i think you're ok here already. 3) write a script that upgrades a single object in place by doing #1, deleting the object, then doing #2 4) write a script that walks a folder tree and does #3 on all instances of the old class. 5) use zsyncer or export / import to copy the objects from the old zope to the new zope. What I am doing is transferring data (not full objects) from one Zope/CMF instance to another. The change of Zope version isn't the issue for me. The issue is the classes present in the two instances. the first instance zope 2.6.1 has a number of products that were written by the group i work with (DF 2.0) and the receiving instance zope 2.7.0-b2 has different classes (DF 3.0) which naturally could not accept the objects from zodb because the supporting classes are not present in their intended new home. What I am having trouble is the path that myObject.invokeFactory(type,id) uses. I try to set up a specific path for myObject but the invokeFactory puts the new object into the DF root rather than into the path for myObject. I do not understand zope well enough to sort out the problem for myself yet, so i posted a question here and in the CMF news group. If you or anybody else can help I'd appreciate it very much. Cheers AlyKey (aka Phil) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] data migration from zope 2.6.1 to zope 2.7.0-b2
Hi, I am fairly new to zope python but I am working to migrate some data/objects from zope 2.6.1 to zope 2.7.0-b2 (and eventually 2.7.0 final. What I am doing is this. (1) get Dublin core metadata + some Dublin core extensions for the objects (2) get pure text representation of object content - I can't use a simple import/export in zexp format because the classes in the receiving zope instance differ significantly from the classes in the sending zope instance. I am able to collect all the data mentioned above and pass it across to the new 2.7.0-b2 zope instance but i am having trouble getting my objects to live where they need to live; specifically their path is not being accepted properly when i recreate the objects. here's a code snippet for an external method i am working on preliminary stuff removed ... def addObjects(self, objectList): from Products.CMFCore.PortalFolder import PortalFolder from OFS.Moniker import Moniker import urllib nameList = [] for myObject in objectList: metadata = myObject[0] content = myObject[1] dcMetadata = metadata['DC'] edcMetadata = metadata['EXTENDED_DC'] name = metadata['OBJECT_ID'] oType = metadata['TYPE'] portalType = metadata['PORTAL_TYPE'] metaType = metadata['META_TYPE'] DCType = dcMetadata['Type'] path = metadata['PATH'] root = metadata['ROOT'] selfPath = self.getPhysicalPath() nameList.append((selfPath,name,portalType,metaType,path)) self.invokeFactory(portalType,'__'+name) q = content['CONTENTS'] uq = urllib.unquote(q) other code to manipulate the object's content removed ... clean up stuff removed ... the line self.invokeFactory(portalType,'__'+name) should be creating the new objects should be created in the context (self) that the external method is executing in - i checked what path 'self' has and it is correct (in this case /DF/testStuff). but instead of being created where I'd expect the new objects are being created in /DF I am sure this all come down to my own inexperience but I would really appreciate any advice that a more experiences python/zope person can give. Cheers, altkey (aka Phil) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )