mediapop / django-friendface

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

FacebookRequestMixin depends on there being an access_token field #88

Open gaqzi opened 11 years ago

gaqzi commented 11 years ago

The FacebookRequestMixin depends on the access_token field. Are there any good reasons to strictly depend on it? Or would it be ok if I just made the code:

    params = dict({'access_token': getattr(self, 'access_token', '')}, **(args or {}))
kitsunde commented 11 years ago

I'm uncertain right now, but if the access token is optional, it shouldn't be passed in as a blank string.

params = args or {}

if hasattr(self, 'access_token'):
    params['access_token'] = self.access_token
gaqzi commented 11 years ago

mm, all for adding it in that way. Since the token isn't strictly speaking necessary for every request, just that for most we do it is.

kitsunde commented 11 years ago

Ah you mean if we say want to make an anonymous or unauthed request, yes? That seems reasonable. I just made the assumption the access token would be there.

gaqzi commented 11 years ago

I was reusing the mixin for a model that didn't have its own access_token but rather used one from a relationship. It had to do with not being able to pull public data from pages with adult themes.

kitsunde commented 11 years ago

Wouldn't be better to use get_access_token() in that case and let the model override it?

gaqzi commented 11 years ago

That is a much, much better idea. :)