RE: [Zope] Upgrading Zclasses
-----Original Message----- From: Itamar S.-T. [mailto:itamars@ibm.net] Sent: Thursday, July 22, 1999 7:06 AM To: Zope-l Subject: [Zope] Upgrading Zclasses
Let's say I create a ZClass and then distribute it to other people, who then use it in their website. If I make changes to the Zclass, the instances get automatically changed, but if the other people using the Zclass want to have my changes, ie. use the updated Zclass, how can they do so and have their instances use it too?
I'll go WAAAY out on a limb here and explain what I think to be so (of course I only learned these details yesterday so ymmv). If anyone knows different please correct me. ZClasses have a unique_id that is generated when they are created. Caveat: older ZClasses didn't do this so you may need to add the id manually (I have no idea how to do this). Instances of this class get this id when they are created. If you distribute a ZClass definition and then upgrade it it will still have the same id. As a result, when you overwrite the new ZClass definition over the older one, it also will have the same class definition. Restarting Zope will cause the new ZClass definition to be loaded and the instances get the new behavior... Pretty cool... Okay Jim and Brian, let the roasting begin! :^) --Rob
Rob Page wrote:
If you distribute a ZClass definition and then upgrade it it will still have the same id. As a result, when you overwrite the new ZClass definition over the older one, it also will have the same class definition. Restarting Zope will cause the new ZClass definition to be loaded and the instances get the new behavior... Pretty cool...
What happens if two different people create ZClasses with the same IDs? For example: Alice creates ZClass Foo. It gets an ID of 2. Bob creates ZClass Bar. It also gets an ID of 2. Bob imports Foo. Since its ID is already used, I assumes it gets assigned a new one, lets say 3. Alice changes Foo, and sends Bob the new Foo. When Bob overwrites the old Foo with the new, Zope has to know the Foo's id was changed to 3 from 2. (I admit to adding the second rhyme on purpose). -- Itamar - itamars@ibm.net ----------------------------o----------------------------------------------o Sealingwax Greeting Cards | Smiley of the day: x=x[:-1] | http://www.sealingwax.com | I truncated a string / Roman Legionnaire |
At 14:32 22/07/99 , Itamar S.-T. wrote:
Rob Page wrote:
If you distribute a ZClass definition and then upgrade it it will still have the same id. As a result, when you overwrite the new ZClass definition over the older one, it also will have the same class definition. Restarting Zope will cause the new ZClass definition to be loaded and the instances get the new behavior... Pretty cool...
What happens if two different people create ZClasses with the same IDs?
For example: Alice creates ZClass Foo. It gets an ID of 2. Bob creates ZClass Bar. It also gets an ID of 2.
Bob imports Foo. Since its ID is already used, I assumes it gets assigned a new one, lets say 3.
Alice changes Foo, and sends Bob the new Foo. When Bob overwrites the old Foo with the new, Zope has to know the Foo's id was changed to 3 from 2. (I admit to adding the second rhyme on purpose).
The ID's generated for ZClasses are pretty random and big. I do not know the exact numbers, but the chances of two ZClasses having the same ID are so remote, that you won't see it happening in your lifetime, nor in those of the next generations. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
"Itamar S.-T." wrote:
Rob Page wrote:
If you distribute a ZClass definition and then upgrade it it will still have the same id. As a result, when you overwrite the new ZClass definition over the older one, it also will have the same class definition. Restarting Zope will cause the new ZClass definition to be loaded and the instances get the new behavior... Pretty cool...
What happens if two different people create ZClasses with the same IDs?
For example: Alice creates ZClass Foo. It gets an ID of 2. Bob creates ZClass Bar. It also gets an ID of 2.
Bob imports Foo. Since its ID is already used, I assumes it gets assigned a new one, lets say 3.
Bob will get an error when he tries to import foo, and he will complain to Alice for using such a silly ID. (Of course, he won't mention to her what a silly ID he picked.) As others have pointed out, the ids generated by ZClasses have an extremely low chance of collision. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (4)
-
Itamar S.-T. -
Jim Fulton -
Martijn Pieters -
Rob Page