2009/11/25 pingviini <jukka.ojani
...@gmail.com>:
> We've been developing a video sharing product for Plone 3 / 4 which
> uses dexterity, but we've had few problems related with dexteritys
> missing support for UIDs.
Dexterity objects have UIDs via zope.intid. They just don't have a
UID() method that returns an Archetypes UID string.
> We're implementing oEmbed interface for our
> package (
http://www.oembed.com) and we need to have unique URL what
> oembed provider can use to provide data to clients. We could use the
> contents original URL, but then we have problems with broken links if
> content is moved to other location so using something like UIDs is
> preferred option.
> I googled around for solutions and found lengthy discussions about
> using IntIds with dexterity to create UIDs and I tried to take that
> approach, but found myself being amazed how things were not working in
> the way I thought they would. On package reinstalls sometimes
> generated UIDs disappeared and IntId utility disappeared regularily
> from site root.
That shouldn't happen. If it does, it's a bug, which I'd ask that you
file. The above is too vague to diagnose, unfortunately.
> As I ran into trouble with IntId approach I developed
> my own UID generator and created new index to portal_catalog for it.
> This solution is working just fine, but I still think this behaviour
> should be provided by the framework and I'd like to know if I've just
> been staring same code too long and can't see how it is really
> supposed to be done?
It's supposed to be done by intids. They're not catalogued by default,
though perhaps they should be?
Note that intids (like AT UIDs) are not stable across sites, i.e. if
you export/import you are liable to get a different UID. For that,
you'd need hash based GUIDS, which is different. I'm sure there's a
Zope/Python package for that somewhere already.
Martin