comparison MoinMoin/user.py @ 6043:1306560f158e

remove print statements from user attr caching code fixes some UnicodeCode crashes, e.g. in "forgot password" functionality, maybe also elsewhere
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 28 Apr 2014 21:55:23 +0200
parents f70b9ab3dedc
children 500f68d3e2fd
comparison
equal deleted inserted replaced
6042:ca4a1bfdf2db 6043:1306560f158e
1036 # first remove all old entries mapping to this userid: 1036 # first remove all old entries mapping to this userid:
1037 for attrname in CACHED_USER_ATTRS: 1037 for attrname in CACHED_USER_ATTRS:
1038 attr2id = cache[attrname] 1038 attr2id = cache[attrname]
1039 for key, value in attr2id.items(): 1039 for key, value in attr2id.items():
1040 if value == userid: 1040 if value == userid:
1041 print "deleting old cached attr %s -> %s" % (key, value)
1042 del attr2id[key] 1041 del attr2id[key]
1043 1042
1044 # then, if user is valid, update with the current attr values: 1043 # then, if user is valid, update with the current attr values:
1045 if self.valid: 1044 if self.valid:
1046 for attrname in CACHED_USER_ATTRS: 1045 for attrname in CACHED_USER_ATTRS:
1047 if hasattr(self, attrname): 1046 if hasattr(self, attrname):
1048 value = getattr(self, attrname) 1047 value = getattr(self, attrname)
1049 if value: 1048 if value:
1050 # we do not store empty values, likely not unique 1049 # we do not store empty values, likely not unique
1051 print "setting new cached attr %s -> %r" % (attrname, value)
1052 attr2id = cache[attrname] 1050 attr2id = cache[attrname]
1053 if isinstance(value, list): 1051 if isinstance(value, list):
1054 for val in value: 1052 for val in value:
1055 attr2id[val] = userid 1053 attr2id[val] = userid
1056 else: 1054 else: