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

Guido van Rossum guido@python.org
Thu, 21 Mar 2002 12:28:02 -0500


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

Modified Files:
	NewJob.py 
Log Message:
Use setViewRequest as intended.


=== Packages/JobBoardEx/NewJob.py 1.2 => 1.3 ===
 
 class NewJob(AttributePublisher, ContextDependent):
+
     index = PageTemplateFile('NewJob.pt')
 
     preview = PageTemplateFile('Preview.pt')
 
     waiting = PageTemplateFile('Waiting.pt')
 
-    def setViewRequest(self, REQUEST):
-        self.request = REQUEST
-        # If we're viewing the NewJob page, this method will still get called,
-        # but there won't be any form variables, so just ignore the KeyErrors
-        try:
-            self.job = Job(REQUEST['submitter'],
-                           REQUEST['summary'],
-                           REQUEST['description'],
-                           REQUEST['contact'])
-        except KeyError:
-            self.job = None
+    def setViewRequest(self, request):
+        self.request = request
+        submitter = request.get('submitter')
+        summary = request.get('summary')
+        description = request.get('description')
+        contact = request.get('contact')
+        self.job = Job(submitter, summary, description, contact)
 
     def getJobView(self):
         view = getRequestView(self.job, 'JobView', self.request)
         return view.simpleView(self.request)
 
-    def cancel(self, REQUEST):
-        return REQUEST.response.redirect('..')
+    def cancel(self):
+        return self.request.response.redirect('..')
 
     home = cancel
 
-    def submit(self, submitter, summary, description, contact, REQUEST):
+    def submit(self, submitter, summary, description, contact):
         """Edits a job object."""
         joblist = self.getContext()
         job = Job(submitter, summary, description, contact)
         joblist.add(job)
-        return self.waiting(REQUEST)
+        return self.waiting(self.request)