[Zope3-dev] Hashing issues

Eldar Omuraliev eomuraliev at gmail.com
Sat Oct 21 17:47:07 EDT 2006


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-dev/attachments/20061021/3985e79b/attachment.htm


More information about the Zope3-dev mailing list