Re: [Zope3-Users] Utility Local to an Annotation?

2007-04-27 Thread Martin Aspeli



Derek Richardson-2 wrote:
 
 Benji York wrote:
 Derek Richardson wrote:
 The specific case is uuids for atom feed entries. We have annotations 
 representing feeds and I would like my uuid utility to be local to the 
 feed annotation, thus recording and making available uuids only for 
 entries in that feed.
 
 How about a multi-adapter from content and feed to UUID?
 
 Hmmm, to do that I have to be able to annotate an annotation, right? As 
 the feed is an annotation and that is where I want to store the UUIDs. I 
 tried this tonight and was unable to make it work - I got the following:
 

There's no reason why you can't mark an object that you fish out of an
annotation with IAttributeAnnotatable and then annotate that. However, this
feels suspiciously like you're asking the wrong kind question. :)

Can you explain (a) what you are trying to store (what is a feed in this
case? is it just feed-specific metadata? or an actual list of items rendered
to RDF?) and (b) what you need UUIDs for and (c) when you need to use the
UUIDS?

Martin
-- 
View this message in context: 
http://www.nabble.com/Utility-Local-to-an-Annotation--tf3646832.html#a10217406
Sent from the Zope3 - users mailing list archive at Nabble.com.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Utility Local to an Annotation?

2007-04-27 Thread Martin Aspeli



Derek Richardson-2 wrote:
 
 Yes, it does feel like I'm going about this the wrong way.
 
 a - The feed is actually just configuration metadata - whether the 
 feed is enabled, whether it is recursive, what its display name is, etc. 
 The actual feed document is not stored - it is simply rendered 
 dynamically when requested, based on the metadata and the existent 
 content items. The feed is an annotation on a container; at the 
 current time, only folders are feeds and only contained files are feed 
 items.
 

Okay, so the feed is really a view, which consults some annotations on a
container and then recursively looks for objects in that container and
constructs XML?



 b - In the Atom syndication format, UUIDs are necessary for two things. 
 One, the overall feed has a UUID. This is easy - I'm storing them in a 
 site-local named utility, indexed by the feed annotation object.
 

What do yuo mean indexed by?

Also, is this UUID not just another aspect of feed metadata and thus a
candidate for the container annotation?


 Two, 
 each entry in a feed has a UUID. A content item that is an entry (a 
 file, in the current case) can, however, be in multiple feeds and needs 
 a different UUID in each. Thus, I need to be able to look up UUIDs by 
 the content object that will be rendered as a feed entry and look them 
 up relative to the feed, rather than globally.
 

That sounds to me like you want a composite UUID - a UUID utility gives each
content item a UUID (which is not feed-specific, and stays in line with the
general concept of a content object UUID). The one you put in the feed is
the feed's UUID and the object's UUID are combined. You could possibly use
some kind of hash if you needed to.



 c - I use the UUIDs only when rendering the feed, looking them up by 
 object and sending them to the client embedded in the feed document. 
 They are used for no other purpose.
 

Still, the concept of a UUID of a content object ought to be separate from
and more general than your particular need for a feed item UUID.



 So, my situation is that I've written my nifty uuid utility based on 
 intid and I want to reuse it for feed entry UUID lookup. I can't use 
 unnamed utilities because I may be accessing different uuid utilities 
 for entries from the same place in the tree. It occurs to me that I 
 could make them named utilities local to the object underlying the entry 
 and look them up by the feed UUID they correspond to, but, in my 
 understanding, that would require littering sites all over the place, 
 which seems like bad citizenship. 
 

It does. I would not do this at all.

I think the cleanest design would be:

 - You have a generic object UUID facility
 - You make a UUID for a feed when you create it, and store it in the feed
annotation
 - You generate feed item UUIDs on the fly from a hash/concatenation of the
feed UUID and the generic object UUID

Martin

-- 
View this message in context: 
http://www.nabble.com/Utility-Local-to-an-Annotation--tf3646832.html#a10221944
Sent from the Zope3 - users mailing list archive at Nabble.com.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Utility Local to an Annotation?

2007-04-27 Thread Martijn Pieters

On 4/27/07, Martin Aspeli [EMAIL PROTECTED] wrote:

I think the cleanest design would be:

 - You have a generic object UUID facility
 - You make a UUID for a feed when you create it, and store it in the feed
annotation
 - You generate feed item UUIDs on the fly from a hash/concatenation of the
feed UUID and the generic object UUID


if you are generating UUID's based on the feed-specific UUID and a
unique identifier for the object, you could just use the already
present intid..

--
Martijn Pieters
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Utility Local to an Annotation?

2007-04-25 Thread Derek Richardson
I would like to create utility instances that are local to annotation 
instances. Each utility would be valid only within the scope of the 
related annotation.


The specific case is uuids for atom feed entries. We have annotations 
representing feeds and I would like my uuid utility to be local to the 
feed annotation, thus recording and making available uuids only for 
entries in that feed. See 
http://www.openplans.org/projects/vice/uuids-in-atom for more details 
and an architectural diagram.


FYI, an object can be syndicated in more than one feed. Thus, for feed 
X, I want to look up the uuid associated with object a for feed x; for 
feed y, I would want the *different* uuid associated with object x (same 
object) for feed y.


However, I am not sure I can turn an annotation into a site and, even if 
I can, am not sure that's what I want to do.


Comments? Suggestions?

Thanks,

Derek

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Utility Local to an Annotation?

2007-04-25 Thread Benji York

Derek Richardson wrote:
The specific case is uuids for atom feed entries. We have annotations 
representing feeds and I would like my uuid utility to be local to the 
feed annotation, thus recording and making available uuids only for 
entries in that feed.


How about a multi-adapter from content and feed to UUID?
--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users