KebasData Refresh bug?
Comparing the original site and my Kebas'd version, I've discovered that I'm not getting data refreshes. Is this a known problem? The data may be viewed at http://sportsters.thuban.org .. the original data is the CHP Current Incidents site (link provided). ---------- Keith J. Farmer kfarmer@thuban.org http://www.thuban.org
Hi, I am currently experimenting with Zope. My goal is it to implement a sort of specialized web-based file server. My first idea was it to make a plain Product (not ZClass based). Reason for this is mainly that I like to controll things. And the Product source in my file system allows for an easy and proven way to archive the source plus I can put it into cvs. Now I plan to get a first release of the Product out and then do maintainance updates on a regular basis. In the beginning there will be only one instance of my Product installed on the customers server - which roughly represents one logical file server (there might be added more, then each project of my customer will get it's own logical file server). Now, I noticed that when I create an instance of a Product, then change the source code of the Product restart Zope the changes won't make it to the instance. Zope seems to copy all the dtml pages into it's db. Now that does not go well with my plan to do regular updates of the Product. Because they won't matter, because the file server will still use the old dtml-pages (I have not tested it, but I assume that the actual source code will come from the latest version of the product only, please correct me if i am wrong). Is there an easy way to update already existing instances of Products to the latest version of the Product? tia, Andreas
On Monday 07 January 2002 07:19 pm, Andreas Leitner wrote:
Hi,
<snip>
Now, I noticed that when I create an instance of a Product, then change the source code of the Product restart Zope the changes won't make it to the instance. Zope seems to copy all the dtml pages into it's db.
<snip>
Is there an easy way to update already existing instances of Products to the latest version of the Product?
yes, use class based dtml files. if you store it as an instance attribute than it will be. this is somewhat of a tradeoff as instance based dtml files can be edited ttw while class based ones can not. so to illustrate from OFS.Folder import Folder from Globals import DTMLFile class FileFoo(Folder): index_html = DTMLFile('ui/FileFooView', globals()) which is a class based view, actually this is more a property of using a dtml file than it is of using a class based syntax. so now you can change the file and changes will be reflected in all instances. the other option which it seems like you're using is something similiar to class FileFoo(Folder): def manage_afterAdd(self, item, container): # adds to dtml methods here self.manage_addProduct['OFSP'].manage_addDTMLMethod() # adds dtml here in the second case, your adding a separate persistent object to your *instance* not class, in which case updates to your class definition will not result in alteration. in this case using something like Craig suggested (an upgrade method/script) as an upgrade path is a good idea. i tend to use the class attribute approach myself, cause i prefer to have the dtml/zpt on the fs for versioning, which ttw editing tends to defeat. cheers kapil
What you are talking about is "schema migration" That is, migrating already existing instances of an object to a new class definition. Here's how we did it: - Create a method in your class called "repair()" It takes no arguments, and makes all of the changes necessary to change an old version to a new version. - Create a "repairAll()" python script in the root folder - execute the repairAll() script (easy way is to use the "test" tab). It recursively calls the repair() method on all instances of the class. - presto! All instances are now up to date. Here is our repairAll() script:
""" $RCSfile: repairAll.py,v $
CVS File Path: $TOP/com/arielpartners/zope/scripts/repairAll.py
Finds all the objects of a given meta-type and calls their "repair" method. Good for migrating objects to a new version of a class or adding/deleting attributes (schema migration)
Standard Zope Parameters: context The object on which the script is being called, also known as the "acquisition parent" of the script. This may be the container, but varies according to the path through which the script is accessed. container The Folder in which this script is located. This doesn't change unless you move the script. If the script is in a ZClass, the Container is the class instance. script The script object itself namespace When the script is called from DTML, this is the caller's DTML namespace, otherwise it is an empty namespace. traverse_subpath When the script is published directly from a URL, this is the portion of the URL path after the script's name, split at slash separators into a list of strings. Otherwise, it is an empty list.
Special Parameters: metaType The type of object to change. For example 'XML Document'
Author: <a href="mailto:cmorris@arielpartners.com">Chip Morris</a> Release: 1.0 """
objects = context.ZopeFind(context, obj_metatypes=[metaType], search_sub=1) map(lambda x: x[1].repair(), objects) return map(lambda x: x[0], objects)
HTH, --Craeg Andreas Leitner wrote:
Hi,
I am currently experimenting with Zope. My goal is it to implement a sort of specialized web-based file server.
My first idea was it to make a plain Product (not ZClass based). Reason for this is mainly that I like to controll things. And the Product source in my file system allows for an easy and proven way to archive the source plus I can put it into cvs.
Now I plan to get a first release of the Product out and then do maintainance updates on a regular basis. In the beginning there will be only one instance of my Product installed on the customers server - which roughly represents one logical file server (there might be added more, then each project of my customer will get it's own logical file server).
Now, I noticed that when I create an instance of a Product, then change the source code of the Product restart Zope the changes won't make it to the instance. Zope seems to copy all the dtml pages into it's db.
Now that does not go well with my plan to do regular updates of the Product. Because they won't matter, because the file server will still use the old dtml-pages (I have not tested it, but I assume that the actual source code will come from the latest version of the product only, please correct me if i am wrong).
Is there an easy way to update already existing instances of Products to the latest version of the Product?
tia, Andreas
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Craeg K Strong, General Partner Ariel Partners LLC voice 781-647-2425 fax 781-647-9690
On Tue, 2002-01-08 at 04:40, Craeg K. Strong wrote:
What you are talking about is "schema migration" That is, migrating already existing instances of an object to a new class definition. Here's how we did it: - Create a method in your class called "repair()" It takes no arguments, and makes all of the changes necessary to change an old version to a new version.
- Create a "repairAll()" python script in the root folder
- execute the repairAll() script (easy way is to use the "test" tab). It recursively calls the repair() method on all instances of the class.
- presto! All instances are now up to date.
Wow, that was quick. Thanks for your answere. Yes this is exactly what I need. This solves my upgrade problem totaly. Now, how do you guys do the actual development. I find it kind of cumbersome to make a change in a dtml file of the Product, restart Zope and repair (migrate) my test-instance. I thought about changing the dtml file in the instance. This way I can test the change immediatly. When I am happy with a certain change I can just copy/paste the complete dtml file back to the Products dtml file and only then restart Zope. Would this be practical, or are there other better ways? Andreas
On Tue, Jan 08, 2002 at 05:07:05AM +0100, Andreas Leitner wrote:
Now, how do you guys do the actual development. I find it kind of cumbersome to make a change in a dtml file of the Product, restart Zope and repair (migrate) my test-instance.
Try the refresh product, and enable auto-refresh on the product you're developing. Saves a *lot* of time restarting zope! -- paul winkler home: http://www.slinkp.com music: http://www.reacharms.com calendars: http://www.calendargalaxy.com
On Tue, 2002-01-08 at 05:46, Paul Winkler wrote:
On Tue, Jan 08, 2002 at 05:07:05AM +0100, Andreas Leitner wrote:
Now, how do you guys do the actual development. I find it kind of cumbersome to make a change in a dtml file of the Product, restart Zope and repair (migrate) my test-instance.
Try the refresh product, and enable auto-refresh on the product you're developing. Saves a *lot* of time restarting zope!
That looks neat. I'll give it a try. thanks, Andreas
On Tue, 2002-01-08 at 16:34, Andreas Leitner wrote:
On Tue, 2002-01-08 at 05:46, Paul Winkler wrote:
On Tue, Jan 08, 2002 at 05:07:05AM +0100, Andreas Leitner wrote:
Now, how do you guys do the actual development. I find it kind of cumbersome to make a change in a dtml file of the Product, restart Zope and repair (migrate) my test-instance.
Try the refresh product, and enable auto-refresh on the product you're developing. Saves a *lot* of time restarting zope!
That looks neat. I'll give it a try.
It's already part of Zope 2.4, fyi. Just put a file called 'refresh.txt' in your prodcut directory and restart, and you're off. seb
participants (6)
-
Andreas Leitner -
Craeg K. Strong -
kapil thangavelu -
Keith J. Farmer -
Paul Winkler -
seb bacon