[BlueBream] Attribute Annotation

Justin Ryan justin.ryan at reliefgarden.org
Sat Jun 19 22:48:09 EDT 2010


Thanks for your assistance, Adam!

I got this working today, and factored out the geolocation code to a package:

  http://launchpad.net/meteor.app.maps

I will provide a usage example soon, basically a content type needs to
alsoProvide (zcml implements seems to do the trick) my IGeoLocation,
as well as passing it to zope.formlib form.Fields() along with the
main schema.

It won't work with any schema that has an 'address' attr, perhaps some
guidance could help me to soften this design so the entire thing is an
annotation.

Latitude and Longitude are stored on IGeoCodedLocation annotation, all
seems to work, kml serves for my site.

Thanks, again!  Note below about what I did..

On Sat, Jun 19, 2010 at 9:30 AM, Justin Ryan
<justin.ryan at reliefgarden.org> wrote:
> On Sat, Jun 19, 2010 at 3:57 AM, Adam GROSZER <agroszer at gmail.com> wrote:
>> Hello Justin,
>>
>
> Howdy. :)
>
>> How is your registration looking?
>> Do you use zope.annotation?
>>
>>  >>> from zope.annotation import factory
>>  >>> component.provideAdapter(factory(Bar))
>>
>> factory is there quite an important part there.
>>
>> If you "just" adapt, the adapter (GeoCodedLocation) won't be
>> referenced by the adapted object, therefore it's never stored in the
>> ZODB.
>>

>
> Do I need to, in my .py file, define something =
> factory(GeoCodedLocation) and refer to that?  This registration felt
> wrong, but I couldn't find an example.
>

This seems to work, I did:

anno_factory = factory(GeoCodedLocation)

where 'factory' is imported from zope.annotation as above..


More information about the bluebream mailing list