Mercurial > kallithea
comparison rhodecode/model/user.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 | fa6ba6727475 |
children | 10b4e34841a4 |
comparison
equal
deleted
inserted
replaced
3624:4dddb7ee8865 | 3625:260a7a01b054 |
---|---|
130 | 130 |
131 try: | 131 try: |
132 new_user.username = username | 132 new_user.username = username |
133 new_user.admin = admin | 133 new_user.admin = admin |
134 # set password only if creating an user or password is changed | 134 # set password only if creating an user or password is changed |
135 if edit is False or user.password != password: | 135 if not edit or user.password != password: |
136 new_user.password = get_crypt_password(password) | 136 new_user.password = get_crypt_password(password) |
137 new_user.api_key = generate_api_key(username) | 137 new_user.api_key = generate_api_key(username) |
138 new_user.email = email | 138 new_user.email = email |
139 new_user.active = active | 139 new_user.active = active |
140 new_user.ldap_dn = safe_unicode(ldap_dn) if ldap_dn else None | 140 new_user.ldap_dn = safe_unicode(ldap_dn) if ldap_dn else None |