comparison rhodecode/lib/auth.py @ 3625:260a7a01b054 beta

follow Python conventions for boolean values True and False might be singletons and the "default" values for "boolean" expressions, but "all" values in Python has a boolean value and should be evaluated as such. Checking with 'is True' and 'is False' is thus confusing, error prone and unnessarily complex. If we anywhere rely and nullable boolean fields from the database layer and don't want the null value to be treated as False then we should check explicitly for null with 'is None'.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 28 Mar 2013 01:10:45 +0100
parents b8f929bff7e3
children 1ec67ddcaffe
comparison
equal deleted inserted replaced
3624:4dddb7ee8865 3625:260a7a01b054
379 else: 379 else:
380 log.debug('No data in %s that could been used to log in' % self) 380 log.debug('No data in %s that could been used to log in' % self)
381 381
382 if not is_user_loaded: 382 if not is_user_loaded:
383 # if we cannot authenticate user try anonymous 383 # if we cannot authenticate user try anonymous
384 if self.anonymous_user.active is True: 384 if self.anonymous_user.active:
385 user_model.fill_data(self, user_id=self.anonymous_user.user_id) 385 user_model.fill_data(self, user_id=self.anonymous_user.user_id)
386 # then we set this user is logged in 386 # then we set this user is logged in
387 self.is_authenticated = True 387 self.is_authenticated = True
388 else: 388 else:
389 self.user_id = None 389 self.user_id = None