Disable button (operator) for certain objects?

I have a custom script that adds some buttons to the interface. Is it possible to only have these buttons enabled when certain objects are selected? If I give an object a custom property, I want the buttons enabled when that object is selected but disabled when an object without the property is selected.

You could test the custom prop on the active object in the poll() method and return True if it meets whatever condition the button likes.


def poll(cls, context):
    return context.object is not None and context.object.your_custom_prop == 'certain_value'