mediapop / django-friendface

Getting Facebook to work for Django.
2 stars 0 forks source link

Kill FacebookPostAsGetMixin in favor of FacebookEnabledTemplateView #42

Closed kitsunde closed 11 years ago

kitsunde commented 11 years ago

FacebookPostAsGetMixin overrides every POST instead of FacebookEnabledTemplateView that only does it when a signed_request has been decoded. I don't it's possible to get it to stop doing that in a mixin since we would need to override def post. It would probably be possible write a decorator for classes that doesn't want to inherit off FacebookEnabledTemplateView (or similar) though. ping @gaqzi

gaqzi commented 11 years ago

If they don't want to inherit off something they'd just not?

The pattern for the actual views are to take all functionality people might want somewhere else and then integrate that through a mixin.

So you should change the logic in FacebookPostAsGetMixin to match what you want and then inherit from that in your view.

So basically all views should be a collection of mixins that do all the work, when you're building generic views.

kitsunde commented 11 years ago

You are right, I should just change the mixin and inherit off that to the FacebookEnabledTemplateView. I was confused on how python inheritance works when one inherited thing calls super(), it appears it'll cascade to the method of the next inherited thing. Like:

class Foo(object):
    def bar(self):
        print "Foo"

class BazMixin(object):
    def bar(self):
        super(BazMixin, self).bar()
        print "BazAlso"

class Bar(BazMixin, Foo):
    pass

Bar().bar()
Foo
BazAlso