[Zope-CVS] CVS: Packages/JobBoardEx - JobList.py:1.17
Guido van Rossum
guido@python.org
Mon, 17 Jun 2002 10:20:27 -0400
Update of /cvs-repository/Packages/JobBoardEx
In directory cvs.zope.org:/tmp/cvs-serv19303
Modified Files:
JobList.py
Log Message:
Give internal attribute names a single leading underscore.
=== Packages/JobBoardEx/JobList.py 1.16 => 1.17 ===
def __init__(self):
- self.id = 0
- self.jobs = PersistentMapping()
+ self._lastid = 0
+ self._jobs = PersistentMapping()
def add(self, job):
- self.id += 1
- jobid = self.id
- self.jobs[jobid] = job
+ self._lastid += 1
+ jobid = self._lastid
+ self._jobs[jobid] = job
# stringified for parity with query
# this can return an int when query can also return an int
return str(jobid)
@@ -25,14 +25,14 @@
except ValueError:
raise KeyError, jobid
- del self.jobs[jobid]
+ del self._jobs[jobid]
def query(self, state):
# this should work returning a list of ints,
# but it exposes a bug in PageTemplates
ids = [jobid
- for jobid, job in self.jobs.items()
+ for jobid, job in self._jobs.items()
if job.state == state]
ids.sort()
return map(str, ids)
@@ -43,7 +43,7 @@
except ValueError:
raise KeyError, jobid
- return self.jobs[jobid]
+ return self._jobs[jobid]
def getPendingIds(self):
return self.query(JobState.PendingApproval)