[Dev] Uses of <cloudAlias>?

Morgen Sagen morgen at osafoundation.org
Thu Jun 2 14:43:55 PDT 2005


On Jun 2, 2005, at 10:31 AM, Phillip J. Eby wrote:
>   Here's my proposed schema API for this, then:
>
>      class Contact(ContentItem):
>
>         contactName = schema.One(ContactName,
>             inverse = ContactName.contact,
>             initialValue=None
>         )
>
>         emailAddress = schema.One(schema.String,
>             displayName="Email Address",
>             initialValue=""
>         )
>
>         # ... more attributes here
>
>         schema.addClouds(
>             sharing = schema.Cloud(
>                 byRef = [emailAddress], byCloud = [contactName]
>             )
>         )
>
> In other words, you include a 'schema.addClouds()' call in the body  
> of the class for a kind, and use keyword arguments to define  
> individual clouds under their respective aliases.  The keyword  
> arguments to the Cloud constructor define the inclusion policies,  
> and each keyword takes a list of endpoint objects that follow that  
> policy.  As a convenient shorthand, using an attribute object in  
> place of an endpoint creates an endpoint with that name, for that  
> attribute, since this is the most common kind of endpoint definition.
>
> I'm thinking that the 'byCloud' keyword should set the cloudAlias  
> to None, but if we need to be explicit about that later, we could  
> add the cloud alias to the keyword.  For example:
>
>         schema.addClouds(
>             sharing = schema.Cloud(
>                 byRef = [emailAddress], byCloud_sharing =  
> [contactName]
>             )
>         )
>
> This would set the cloudAlias for the contactName endpoint to  
> "sharing".  A similar technique could also be used for byMethod,  
> e.g. "byMethod_someMethod=[someAttr]", if it turns out we need that.
>
> Initially, however, I would just do the basic keywords with no  
> dynamic cloudAlias or method names.
>
> Anybody have any comments?

I do have a situation in which I want to override an endpoint that  
normally would get inherited; ContentItem's sharing cloud has a  
"displayName" endpoint -- however for ItemCollection (which subkinds  
ContentItem) I don't want to have a displayName endpoint.  My fix for  
this was to define a displayName endpoint on ItemCollection's sharing  
cloud but set that endpoint's includePolicy to "none".  Does that  
work with your syntax?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://localhost.localdomain/pipermail/dev/attachments/20050602/e9abfd11/attachment.htm


More information about the Dev mailing list