Martin Aspeli wrote:
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.
I doubt it would be all that difficult to change the publisher to handle unicode path segments.
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.
This is what I'm worried about. If new code uses __name__ instead, then it opens up the possibility to share ZODB content between Plone and lightweight systems like repoze.bfg, as well as making it easier for Plone to migrate to a cleaner content model. Plone has been around for eight years now, I sincerely hope we are not still stuck on OFS.SimpleItem for another eight years! Laurence