[Zope] Re: [Re: [Zope] Dictionary properties within Zope.]

Andreas Kostyrka andreas@mtg.co.at
Sun, 29 Aug 1999 22:14:07 +0200 (CEST)


On 29 Aug 1999 happyrhino@usa.net wrote:

> >Actually, this can be done much nicer in ZOPE with the Navigation >Product.
> 
> Maybe but I then call these dictionary keys in SQL statements. They're
> ingrained into the website.
Hmmm. Well, let's hope you won't have to change the titles of some pages.
Reduant data is not a good idea, at least not from the viewpoint of data
consistency. ;)
> True. It would be best if these were generated on-the-fly but 
But?
Sorry, the fact is, that "HTML pages" are usually generated from ZOPE
objects. As such, you should not store their URLs or titles in some
additional storage, or you are in an awful portion of maintenance
problems. (Well, other systems don't allow for this, but then there are
many sites with broken links, right?)

> Actually, navigation is done via lists. The dictionaries provide
> titles or urls for the navigation :) Subtle difference.
Ok, so you have multiply reduant data:
*) list of dictionary keys. What happens if you make an typo in the list,
   or the dictionary.
*) URL of object. Again the same.
> 
> Anyway, I think I've found a way to do it. Not very elegant though =
> 
> Create a 'lines' property called 'dico'
> eg. bio:Biohazard
>     chem:Chemical
>     
> Then in the DTML document use 
> <dtml-in dico>
> <dtml-var "_.string.split(sequence-item,':')[0]">
> <dtml-var "_.string.split(sequence-item,':')[1]">
Well, try _.string.split(_['sequence-item'],':')[0]

> By the way, is that really the way to use Python string services ?
Yeap, it is ;)

Andreas
--
Andreas Kostyrka                     | andreas@mtg.co.at
phone: +43/1/7070750                 | phone: +43/676/4091256   
MTG Handelsges.m.b.H.                | fax:   +43/1/7065299
Raiffeisenstr. 16/9                  | 2320 Zwoelfaxing AUSTRIA