[Zope3-dev] Hashing issues
Christian Theune
ct at gocept.com
Sat Oct 21 20:31:45 EDT 2006
Could you check whether one server is 32-bit, the other 64-bit? (And
Python being compiled in 32-bit on one machine and 64-bit the other.)
I had some trouble with the hash function in this setup lately.
Christian
Eldar Omuraliev wrote:
> Greetings
> I hash some objects and it works fine when I set and get them. However,
> when
> I move the Data.fs to a different server on a separate machine running
> exactly the same code, the hashes don't match.
>
> Here's the code:
> (I tried the paste bin, but it was done at the moment)
> class JournalContainer(btree.BTreeContainer):
> """Container of Journals"""
>
> implements(interfaces.IJournalContainer)
>
> def __init__(self):
> super(JournalContainer, self).__init__()
> self._index = persistent.dict.PersistentDict()
>
> def add(self, journal, person, section):
> chooser = INameChooser(self)
> name = chooser.chooseName('',journal)
> self[name] = journal
> personHash = hash(IKeyReference(person, None))
> sectionHash = hash(IKeyReference(section, None))
> self._index[(personHash, sectionHash)] = journal
>
> def getJournal(self, person, section):
> import pdb;pdb.set_trace()
> personHash = hash(IKeyReference(person, None))
> sectionHash = hash(IKeyReference(section, None))
> return self._index.get((personHash, sectionHash), None)
>
> def remove(self, person, section):
> del self[self.getJournal(person, section).__name__]
> personHash = hash(IKeyReference(person, None))
> sectionHash = hash(IKeyReference(section, None))
> del self._index[(personHash, sectionHash)]
>
>
> What are we doing wrong/What is causing the problem? How should we go about
> fixing this.
>
> Thank you very much.
> -Eldar Omuraliev
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub: http://mail.zope.org/mailman/options/zope3-dev/ct%40gocept.com
>
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20061022/96726475/signature.bin
More information about the Zope3-dev
mailing list