On Fri, 2006-10-11 at 08:00 +0000, Chris Withers wrote:
> This is a toy example, but I need to do something similar and can't seem 
> to get the registration right...
> 
> How can I register the str builtin as an adapter from python int objects 
> to python str objects?

I've personally found when I run into a situation where it seems like I
need to adapt on the builtin str class, I should probably be using named
adapters or named utilities instead.

I use this technique for example to lookup mime type stuff in one of my
apps.

<adapter
    for="*"
    name="text/html"
    factory=".somemodule.SomeClass"
    provides=".interfaces.ISomeMimeTypeHandlerThingie"
    />

from zope import component
component.getAdapter(randomobj, ISomeMimeTypeHandlerThingie,
name='text/html')


- Rocky

-- 
Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to