No Judge or Magistrate shall, except with the permission of the court to which an appeal lies from his court, try or commit for trial any case to or in which he is a party, or personally interested, and no Judge or Magistrate shall hear an appeal from any judgment or order passed or made by himself.
Explanation. A Judge or Magistrate shall not be deemed to be a party to, or personally interested in, any case by reason only that he is concerned therein in a public capacity, or by reason only that he has viewed the place in which an offence is alleged to have been committed or any other place in which any other transaction material to the case is alleged to have occurred and made an inquiry in connection with the case.