[Zope] Random line of Products

Oleg Broytmann phd2@mail.com
Fri, 9 Jun 2000 15:04:58 +0000 (GMT)


Hello!

   I created and published three demo toy Products I named them "Random"
Products, because each of them displays text, randomly selected from a list
prepared by webmaster. These Products differ in how they store the text
items. I learned a good deal of Zope internals while wrote it, and I hope
that looking into it will help people to learn Product API. I also run a
demo site for these Products.

   Source code: http://www.zope.org/Members/phd/Random/
   Demo site  : http://sun.med.ru/pcgi/Random/

DETAILS:

   The first Product, RandomLine was created from Boring Product - I just
learned Product API. The product stores text (edited in a texarea), splits
the text into a list of lines and when asked displays a random line.

   The second Product, RandomLine_v, is just a modified version of the
first. The difference is volatile attributes. I found (in RandomLine) that
I store both text and splitted list of strings in ZODB. I thought I need to
learn volatile attributes and this version stores only text in ZODB. The
splitted list stored in a volatile attribute and recomputed when
neccessary.

   The third Product, RandomItem, implements the same idea, but with
different implementation. The core class is ObjectManager-derived, and it
stores a list of items. Every item in turn stores multiline text.

Oleg.
---- 
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd2@mail.com
           Programmers don't die, they just GOSUB without RETURN.