Skip to content

Commit e93a412

Browse files
author
Ralf Schlatterbeck
committed
issue2550729: Fix password history display for anydbm backend...
...thanks to Ralf Hemmecke for reporting.
1 parent ad870d6 commit e93a412

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Fixed:
2424
field of a user -- this would match substrings, e.g. if the user has
2525
[email protected] as an alternate email and an incoming mail
2626
is addressed to [email protected] this would (wrongly) match. (Ralf)
27+
- issue2550729: Fix password history display for anydbm backend, thanks
28+
to Ralf Hemmecke for reporting.
2729

2830
2011-07-15 1.4.19 (r4638)
2931

roundup/backends/back_anydbm.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,21 @@ def setjournal(self, classname, nodeid, journal):
575575
self.transactions.append((self.doSetJournal, (classname, nodeid,
576576
journal)))
577577

578+
def fix_journal(self, classname, journal):
579+
""" fix password entries to correct type """
580+
pwprops = {}
581+
for pn, prop in self.getclass(classname).properties.iteritems():
582+
if isinstance(prop, hyperdb.Password):
583+
pwprops [pn] = 1
584+
if not pwprops:
585+
return journal
586+
for j in journal:
587+
if j[3] == 'set':
588+
for k, v in j[4].items():
589+
if k in pwprops:
590+
j[4][k] = password.JournalPassword(j[4][k])
591+
return journal
592+
578593
def getjournal(self, classname, nodeid):
579594
""" get the journal for id
580595
@@ -611,22 +626,22 @@ def getjournal(self, classname, nodeid):
611626
raise
612627
if res:
613628
# we have unsaved journal entries, return them
614-
return res
629+
return self.fix_journal (classname, res)
615630
raise IndexError('no such %s %s'%(classname, nodeid))
616631
try:
617632
journal = marshal.loads(db[nodeid])
618633
except KeyError:
619634
db.close()
620635
if res:
621636
# we have some unsaved journal entries, be happy!
622-
return res
637+
return self.fix_journal (classname, res)
623638
raise IndexError('no such %s %s'%(classname, nodeid))
624639
db.close()
625640

626641
# add all the saved journal entries for this node
627642
for nodeid, date_stamp, user, action, params in journal:
628643
res.append((nodeid, date.Date(date_stamp), user, action, params))
629-
return res
644+
return self.fix_journal (classname, res)
630645

631646
def pack(self, pack_before):
632647
""" Delete all journal entries except "create" before 'pack_before'.

0 commit comments

Comments
 (0)