[Zope-CVS] CVS: Packages/JobBoardEx - IJob.py:1.5 Job.py:1.4

Fred L. Drake, Jr. fdrake@acm.org
Wed, 20 Mar 2002 12:39:57 -0500


Update of /cvs-repository/Packages/JobBoardEx
In directory cvs.zope.org:/tmp/cvs-serv25069

Modified Files:
	IJob.py Job.py 
Log Message:
Do not assume that an ID will be availble when a Job is first created,
but make sure it can be set at most once.


=== Packages/JobBoardEx/IJob.py 1.4 => 1.5 ===
 
     id = Attribute("id",
-                   "Unique ID relative to the containing job list")
+                   "Unique ID relative to the containing job list.\n"
+                   "This can be set at most once.")
 
     submitter = Attribute("submitter",
                           "Email address of the submitter")


=== Packages/JobBoardEx/Job.py 1.3 => 1.4 ===
 
     def __init__(self, submitter, summary, description,
-                 contactURL, contactEmail, id):
+                 contactURL, contactEmail):
         self.submitter = submitter
         self.summary = summary
         self.description = description
         self.contactURL = contactURL
         self.contactEmail = contactEmail
-        self.id = id
+        self.__id = None
         self.state = JobState.PendingApproval
+
+    def _get_id(self):
+        return self.__id
+
+    def _set_id(self, id):
+        if self.__id is not None:
+            raise ValueError("cannot change id once set")
+        self.__id = id
+
+    id = property(_get_id, _set_id,
+                  doc="Unique identifier within the job list.")
 
     def approve(self):
         """Moves the job state to approved"""