[Zope3-Users] Adapting a builtin?
mh at gocept.com
Wed Dec 7 02:58:51 EST 2005
On Tue, 2005-12-06 at 18:44 -0500, Paul Winkler wrote:
> Is it possible to register an adapter for a builtin type
> such as str? All the adapter examples I see use an interface for the
> "for" attribute.
> Something like:
> <adapter for="str"
in plain Zope3 (I'm not using Five, but it may be similar there.) you
can declare an interface for the buitin: (e.g. in interfaces.py)
class interface IStr(Interface):
# define the methods here which you need to access
"upper ... as an example"
In configure.zcml, you declare the interface for the builtin:
<implements interface=".interfaces.IStr" />
Then you can do:
IHTTPConnection('string') to get the adapter.
More information about the Zope3-users