Attribute problem with defining Camera for context object
The properties panel has some of its own context members that only work in the property panel space. The "context" attribute of the space is shown in the icons across the top which change for what type of object is active, eg a camera icon for the data part of a camera object, in which case context.camera resolves to the data part of the active object, similarly for context.lamp and context.speaker for those types of object.  

This is something to look out for when refactoring code from space_properties to, for instance, the 3D toolshelf. Anyhoo a good workaround here is 

cam = context.scene.camera.data


the "active camera", ie the one that renders the scene, or for the context object

cam = context.active_object.data


and in the poll method make sure 'context.scene` and or context.scene.camera are not None, and if using the latter that context.active_object is not None and  context.active_object.type is 'CAMERA' 

example poll

    @classmethod
    def poll(cls, context):
        if context.active_object is None:
            return False
        return context.active_object.type == 'CAMERA'