Skip to content

Commit ce5cb2d

Browse files
author
Richard Jones
committed
Fixed a couple of dodgy bits found by pychekcer.
1 parent 7438585 commit ce5cb2d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

roundup/roundupdb.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.46 2002-02-25 14:22:59 grubert Exp $
18+
# $Id: roundupdb.py,v 1.47 2002-02-27 03:16:02 richard Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
2222
"""
2323

2424
import re, os, smtplib, socket, copy, time, random
25-
import mimetools, MimeWriter, cStringIO
25+
import MimeWriter, cStringIO
2626
import base64, mimetypes
2727

2828
import hyperdb, date
@@ -42,15 +42,15 @@ def splitDesignator(designator, dre=re.compile(r'([^\d]+)(\d+)')):
4242
return m.group(1), m.group(2)
4343

4444

45-
def extractUserFromList(users):
45+
def extractUserFromList(userClass, users):
4646
'''Given a list of users, try to extract the first non-anonymous user
4747
and return that user, otherwise return None
4848
'''
4949
if len(users) > 1:
5050
# make sure we don't match the anonymous or admin user
5151
for user in users:
5252
if user == '1': continue
53-
if self.user.get(user, 'username') == 'anonymous': continue
53+
if userClass.get(user, 'username') == 'anonymous': continue
5454
# first valid match will do
5555
return user
5656
# well, I guess we have no choice
@@ -73,20 +73,22 @@ def uidFromAddress(self, address, create=1):
7373
(realname, address) = address
7474

7575
# try a straight match of the address
76-
user = extractUserFromList(self.user.stringFind(address=address))
76+
user = extractUserFromList(self.user,
77+
self.user.stringFind(address=address))
7778
if user is not None: return user
7879

7980
# try the user alternate addresses if possible
8081
props = self.user.getprops()
8182
if props.has_key('alternate_addresses'):
8283
users = self.user.filter({'alternate_addresses': address},
8384
[], [])
84-
user = extractUserFromList(users)
85+
user = extractUserFromList(self.user, users)
8586
if user is not None: return user
8687

8788
# try to match the username to the address (for local
8889
# submissions where the address is empty)
89-
user = extractUserFromList(self.user.stringFind(username=address))
90+
user = extractUserFromList(self.user,
91+
self.user.stringFind(username=address))
9092

9193
# couldn't match address or username, so create a new user
9294
if create:
@@ -543,7 +545,7 @@ def generateChangeNote(self, nodeid, oldvalues):
543545
l = changed.items()
544546
l.sort()
545547
for propname, oldvalue in l:
546-
prop = cl.properties[propname]
548+
prop = props[propname]
547549
value = cl.get(nodeid, propname, None)
548550
if isinstance(prop, hyperdb.Link):
549551
link = self.db.classes[prop.classname]
@@ -594,6 +596,9 @@ def generateChangeNote(self, nodeid, oldvalues):
594596

595597
#
596598
# $Log: not supported by cvs2svn $
599+
# Revision 1.46 2002/02/25 14:22:59 grubert
600+
# . roundup db: catch only IOError in getfile.
601+
#
597602
# Revision 1.44 2002/02/15 07:08:44 richard
598603
# . Alternate email addresses are now available for users. See the MIGRATION
599604
# file for info on how to activate the feature.

0 commit comments

Comments
 (0)