I put a note in another of your questions re context.lamp. 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. 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
or cam = context.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.object.type (or context.active_object.type) is 'CAMERA'