← Back to team overview

divmod-users team mailing list archive

[Axiom] Why does Empowered.__conform__ need a store?

 

Empowered.__conform__ gives up if there is no store. That makes sense
for persisted powerups (obviously), but it means that the following
doesn't work:

    >>> rodimus = Transformer(name=u"Rodimus Prime", damage=50)
    >>> hotRod = HotRod(color=u"Red and yellow")
    >>> rodimus.inMemoryPowerUp(hotRod, ICar)
    >>> assert ICar(rodimus) is hotRod
    Traceback (most recent call last):
    ...
    TypeError: ('Could not adapt', ...)

You can see this in action here:
https://travis-ci.org/lvh/axiombook/builds/4628027

The reason it doesn't work is that __conform__ craps out.

I think this is a bug, because the docstring for __conform__ appears
to suggest that it should just use the first powerup from powerupsFor;
but that uses _inMemoryPowerups before looking at stored powerups,
exactly as the inMemoryPowerup docstring suggests as well.

-- 
cheers
lvh


Follow ups