[Zope3-dev] Hashing issues

2006-10-21 Thread Eldar Omuraliev
GreetingsI 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@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Hashing issues

2006-10-21 Thread Christian Theune
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@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 - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development




signature.asc
Description: OpenPGP digital signature
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com