Hello, I'm using new-style classes and properties to implement multilingual support in my objects. I might therefore have something like:
mything = property(__get_mything) def __get_mything: return self.__mything_en (Extremely simplified!) This works fine. Now however I'm discovering that doing a hasattr() on anything that starts with 2 underscores always returns false! So hasattr(self, '__thumbnail') doesn't work as expected, but hasattr(self, '_thumbnail') DOES! (All other things being equal of course). I've successfully tested this by replacing this code, which didn't work as expected: def __get_thumbnail(self): if not hasattr(self, '__thumbnail'): self.setThumbnail() return self.__thumbnail else: return self.__thumbnail With this one: def __get_thumbnail(self): try: return self.__thumbnail except: self.setThumbnail() return self.__thumbnail Which DID work as expected (Though I suspect the try ... except might be faster anyways!) ... I checked the Collector: http://www.zope.org/Collectors/Zope/collector_contents?searching=yep&Searcha bleText=hasattr&status%3Alist%3Aignore_empty=Accepted&status%3Alist%3Aignore _empty=Pending Nothing jumped out at me as being relevant ... Any ideas? Jean-François Doyon Internet Service Development and Systems Support / Spécialiste de dèveloppements internet et soutien technique Canada Centre for Remote Sensing/Centre Canadien de télédétection Natural Resources Canada/Ressources Naturelles Canada http://atlas.gc.ca Tel./Tél.: (613) 992-4902 Fax: (613) 947-2410 _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )