[Chandler-dev] Stamp/Annotation-related questions

Bryan Stearns stearns at osafoundation.org
Thu Aug 10 16:57:26 PDT 2006


Hi Grant,

I only have a suggestion for question # 1...

Grant Baillie wrote:
> So, as I plough on through stamping-as-annotations, I found some 
> issues that are more related to using annotations than stamping per 
> se. They're both cases where the annotation class has attributes that 
> aren't repository values. I'd be interested in hearing if my 
> strategies for solving these in the schema itself are reasonably, or 
> if there's a better way of approaching things.
>
> 1) The osaf.pim.Calculated class (essentially, the analog of a python 
> property) doesn't play quite so nicely inside Annotations. You can go 
> ahead and do
>
> class MyAnnotation(schema.Annotation):
>
>     schema.kindInfo(annotates=pim.ContentItem)
>
>     myProp = pim.Calculated(schema.Text, ....)
>
> and then code such as:
>
>     MyAnnotation(someItem).myProp = ... something or other ...
>
> works just fine. The problem is that things like attribute editors 
> (and indexes) want to talk to items  -- not Annotation/Stamp instances 
> -- directly by attribute name. So, they require an item and an 
> attribute name in order to edit or index something, but the property 
> doesn't appear in the target class (ContentItem above). Is there a 
> reasonable way to make this work? For instance, you could add a 
> suitably wrapped property on the fly to the ContentItem class, but 
> then you would have to be sure that this happened each time Chandler 
> ran (i.e. it should happen at class object instantiation time, not 
> parcel initialization time).
When I wrote Calculated, I talked with pje and we agreed that it didn't 
need to be moved into the schema world until there was a reason to -- is 
this a reason? (that is, the schema stuff could mangle the name of the 
Calculated property's descriptor (do they have descriptors?) at 
definition time, the way it does with 'real' schema attributes now ... 
though I'm not sure whether something needs to happen with the fset/fget 
method names too... pje?)

...Bryan


More information about the chandler-dev mailing list