[Grok-dev] Simple adapter question

Jan Ulrich Hasecke juhasecke at googlemail.com
Thu Mar 5 12:25:40 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

browsing the docs I have a question concerning adapters.

import grok
from zope import interface

class Fireplace(grok.Model):
    pass

class Cave(grok.Model):
    pass

class IHome(interface.Interface):
    pass

class Home(grok.MultiAdapter):
    grok.adapts(Cave, Fireplace)
    grok.implements(IHome)

    def __init__(self, cave, fireplace):
        self.cave = cave
        self.fireplace = fireplace

home = IHome(cave, fireplace)

Why is there an IHome in the last line? I would think that

home = Home(cave, fireplace)

would create a home-instance.


juh

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (Darwin)

iEYEARECAAYFAkmwCxQACgkQPUzUEFbILMQotgCeI071gECfri5WyAKYx/QZCsDZ
k/IAoNwIb5EshLBtW4nPRQv+gRzIvfA7
=G+1K
-----END PGP SIGNATURE-----


More information about the Grok-dev mailing list