[Zope] Question about Python with Zope/ZSQL

Ulrich Wisser ulrich.wisser at relevanttraffic.se
Thu Aug 26 08:27:43 EDT 2004


Hi John,

the addNewSurvey.py you attached is hopefully not the script you run.
It has more bugs then will fit in one mail. The main functionality is
in a function that is never called, the function has several return 
statements on the same call level. Even a nested function with an 
identical name defined.

Probably you were looking for something like:


test = context.checkforsurvey(surveyid=surveyid)
true = 'true'

   if test == true:
     return 'redirect'
     target = '../duplicatesurvey'
     return context.REQUEST.RESPONSE.redirect(target)
   else:
     test2 = context.checkforlistener(listenerid=listenerid)
     if test2 == true:
         context.sqlAddSurvey(surveyid=surveyid, listenerid=listenerid, 
region=region, firstname=firstname, lastname=lastname, updates=updates, 
question01=question01, question02=question02, question03=question03, 
question04=question04,  question05=question05, question06=question06, 
question07=question07, question08=question08, question09=question09, 
question10=question10, question11=question11, completed=completed)
         target = '../calls/newcall?surveyid=' + surveyid
         context.REQUEST.RESPONSE.redirect(target)
       else:
         target = '../duplicatesurvey'
         context.REQUEST.RESPONSE.redirect(target)


Ulrich
-- 
------------------------------------------------------------
Relevant Traffic AB, Riddargatan 10, 11435 Stockholm, Sweden
Tel. +46-8-6789750             http://www.relevanttraffic.se



More information about the Zope mailing list