comparison MoinMoin/script/account/disable.py @ 1414:614005b5edb3

fixed some .format() unicode issues, partially fixing bug #124
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 Jul 2012 20:22:21 +0200
parents 4ac437141bbe
children 2be00a5febbe
comparison
equal deleted inserted replaced
1413:caa408751799 1414:614005b5edb3
35 u = user.User(uid) 35 u = user.User(uid)
36 elif name: 36 elif name:
37 u = user.User(auth_username=name) 37 u = user.User(auth_username=name)
38 38
39 if not u.exists(): 39 if not u.exists():
40 print 'This user "{0}" does not exists!'.format(u.name) 40 print 'This user "{0!r}" does not exists!'.format(u.name)
41 return 41 return
42 42
43 print " {0:<20} {1:<25} {2:<35}".format(u.id, u.name, u.email), 43 print " {0:<20} {1:!r<25} {2:<35}".format(u.id, u.name, u.email),
44 if not u.disabled: # only disable once 44 if not u.disabled: # only disable once
45 u.disabled = 1 45 u.disabled = 1
46 u.name = "{0}-{1}".format(u.name, u.id) 46 u.name = u"{0}-{1}".format(u.name, u.id)
47 if u.email: 47 if u.email:
48 u.email = "{0}-{1}".format(u.email, u.id) 48 u.email = u"{0}-{1}".format(u.email, u.id)
49 u.subscribed_items = [] # avoid using email 49 u.subscribed_items = [] # avoid using email
50 u.save() 50 u.save()
51 print "- disabled." 51 print "- disabled."
52 else: 52 else:
53 print "- is already disabled." 53 print "- is already disabled."