[z3-five] SimpleViewClass and __hash__

Tarek Ziadé tziade at nuxeo.com
Sun May 8 23:45:20 CEST 2005


Hi,

I've ran into some problems with CPSSkins under CPS3 and a Product using 
Five.

CPSSkins creates a persistent dictionnary wich keys are zope 2 methods 
names (zpt, py, dtml, etc)

It raises errors on pages templates created through Five because they do 
not have a __hash__ method
for the dict to work properly.

I would like to suggest a change in 
pagetemplatefile.ZopeTwoPageTemplateFile by adding a hash method :

    def __hash__(self):
        return hash(self._cook)

then in browserconfigure, adding a method :

def __hash__(self):
    return hash(self.index)

that's binded in makeClassForTemplate to class_ =

class_.__hash__ = __hash__


That would make page templates usable as dictionnary keys in Zope 2.

Cheers

Tarek

-- 
Tarek ZIADE, Nuxeo SARL: Zope Service Provider.
Mail: tz at nuxeo.com - Tel: +33 (0)6 30 37 02 63
Nuxeo Collaborative Portal Server: http://www.nuxeo.com/cps
Gestion de contenu web / portail collaboratif / groupware / open source



More information about the z3-five mailing list