Laurence Rowe wrote: > Martin Aspeli wrote: >> Hi, >> >> First - a quick question: can we treat __name__ and id/getId()/_setId() >> as the same, always? OFS.SimpleItem has some support for letting id and >> name be the same, but the link is lost once both __name__ and id are >> set. Why isn't __name__ just a property that reflects self.id ? > > I would prefer this to be the other way around -- getId() / _setId() > should operate on __name__. It will be easier to drop OFS support in the > future if pickles store the real __name__ and __parent__ attributes. We > will presumably require a migration now anyway to add __parent__ pointers.
It kind of already does that if 'id' isn't set. But when 'id' is set, they diverge. Also note that according to ILocation, __name__ is a TextLine, which implies unicode. unicode ids are a no-no in Zope 2. The current solution I've put into dexterity is to let __name__ be a property that gets and sets id, but assumes its value is unicode. It'll fail if the unicode string can't be encoded to ASCII, though. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )