[WIP] Update check for non-available gradient.

This solves the problem discussed at https://github.com/pymc-devs/pymc/issues/336#issuecomment-24175697 and  https://groups.google.com/d/topic/theano-users/nQshB8gUA6k/discussion

Please do not merge before I add a unit test.