facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.29k stars 635 forks source link

facebook_business/adobjects/abstractobject.py:59: return other is not None and hasattr(targeting, 'export_all_data') and \ <class 'NameError'>: name 'targeting' is not defined #504

Closed abetomo closed 6 years ago

abetomo commented 6 years ago

https://github.com/facebook/facebook-python-business-sdk/commit/dd8d9de4519f98feb5bfc3e9271d18be8110c6a6#diff-5c2ee73c9f7f6f616946f19e23a7dae9R58

It seems that the automatically generated code is wrong.

hasattr(targeting, 'export_all_data')

->

hasattr(other, 'export_all_data')

lucasrcosta commented 6 years ago

A temp fix:

from facebook_business.adobjects.abstractobject import  AbstractObject

def abstract_object_eq(self, other):
    return other is not None and hasattr(other, 'export_all_data') and \
        self.export_all_data() == other.export_all_data()

AbstractObject.__eq__ = abstract_object_eq
jingping2015 commented 6 years ago

This should fix in our next release.