[Zope-CVS] CVS: Packages/JobBoardEx/Views/Browser - NewJob.py:1.3

Barry Warsaw barry@wooz.org
Wed, 20 Mar 2002 12:55:35 -0500


Update of /cvs-repository/Packages/JobBoardEx/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv29867/Views/Browser

Modified Files:
	NewJob.py 
Log Message:
getJobView(): Added this so that we could factor out the job view.

submit(): Made this conform to the IJobList interface for adding jobs,
and the new Job constructor.


=== Packages/JobBoardEx/Views/Browser/NewJob.py 1.2 => 1.3 ===
 from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
 from Zope.ComponentArchitecture.ContextDependent import ContextDependent
+from Zope.ComponentArchitecture import getView
+
+from ZopeProducts.JobBoardEx.Job import Job
 
 
 class NewJob(AttributePublisher, ContextDependent):
@@ -27,6 +30,11 @@
 
     waiting = PageTemplateFile('Waiting.pt')
 
+    def getJobView(self, submitter, summary, description, contact, REQUEST):
+        job = Job(submitter, summary, description, '', contact)
+        view = getRequestView(job, 'JobView', REQUEST)
+        return view.simpleView(REQUEST)
+
     def cancel(self, REQUEST):
         # XXX This redirect will change
         return REQUEST.RESPONSE.redirect('Hello.pt')
@@ -36,7 +44,6 @@
     def submit(self, submitter, summary, description, contact, REQUEST):
         """Edits a job object."""
         joblist = self.getContext()
-        # XXX: This method name may change
-        joblist.addJob(submitter, summary, description, contact)
+        job = Job(submitter, summary, description, '', contact)
+        joblist.add(job)
         return self.waiting(REQUEST)
-