[Zope] hash and username variables

Konstantinos Margaritis markos@debian.org
Fri, 8 Jun 2001 19:24:58 +0300 (EEST)


Hi,
After a lot of experiments I finally found out how to do this.
I am describing the process here in case someone is interested.
It really is very simple, but for some reason I could not use the builtin
hash() function/methond of zope.
Thanks for all the help.

a) First create a Python script method (I named it make_key) with 1
argument the object which to hash (I called it text):

# make_key(text)
# return the positive hash of the input argument
return abs(hash(text))

Then in any methond you want to call the hash method, include the
following:

<dtml-var "make_key(insert_text_argument_here)">

That's it. It really saved me trying to create a database with unique
objects (such as big texts) that I could not really use the indexing on
them. I know I could use the ZCatalog class, but that will be in a next
version :-) I still am in the process of learning zope. May I say that it
is the greatest application server I ever saw? Congratulations!

Regards

Konstantinos Margaritis