def _on_signin(self, data, auth_info, provider):
        auth_id = '%s:%s' % (provider, data['id'])
        logging.info('Looking for a user with id %s' % auth_id)

        user = self.auth.store.user_model.get_by_auth_id(auth_id)
        if user:
            logging.info('Found existing user to log in')
            # existing user. just log them in.
            self.auth.set_session(
              self.auth.store.user_to_dict(user)
            )

        else:
            # check whether there's a user currently logged in
            # then, create a new user if nobody's signed in,
            # otherwise add this auth_id to currently logged in user.
            if self.logged_in:
                logging.info('Updating currently logged in user')

                u = self.current_user
                u.auth_ids.append(auth_id)
                u.populate(**self._to_user_model_attrs(data, self.USER_ATTRS[provider]))
                u.put()

            else:
                logging.info('Creating a brand new user')

                ok, user = self.auth.store.user_model.create_user(
                  auth_id, **self._to_user_model_attrs(data, self.USER_ATTRS[provider])
                )
                
                logging.info('user: %s' % user)
                
                if ok:
                    self.auth.set_session(
                      self.auth.store.user_to_dict(user)
                    )

        self.redirect('/')
Regression test for bug #8036
dataset/ETHPy150Open ibagrak/algae/gae/handlers/oauth.py/AuthHandler._on_signin--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/select_related_regress/tests.py/SelectRelatedRegressTests.test_regression_8036