Check if self has attributes 'session' and 'db'.