I found the problem!!!

I had inadvertently removed the validator from a widget definition I
use on the index/main page.
The  @validate(form=select_sandboxid_form) statement on my index
method was causing the crash (I assume because there was no validator
defined for the form!!).

Regards,

On May 24, 4:34 pm, Denny <[EMAIL PROTECTED]> wrote:
> This application has quite but of code; 5-10 python source files; and
> an equal number of kid files.
>
> Here's the controller.py as a start!  Do you want/need more??
>
> =======================
>
> import logging
> import cherrypy
> from datetime import datetime
>
> import turbogears
> from turbogears import (controllers, expose, validate, redirect,
>                                                                               
>           widgets, validators, error_handler)
> from research import json
> from string import digits
> import os,sys
>
> from model import *
> from researchforms import *
> from historyservice import *
> from sendEmail import send_mime_msg
> import export2csv as csv
>
> # log = logging.getLogger("research.controllers")
>
> DEBUG = True              # Print debug/trace statements (e.g.
> functions/methods entered and their parameters,
>                                                                               
>   #        db query strings, etc.)
> VERBOSE = False        # Pring out MUCH more details (e.g. returned
> results from db queries)
>
> class Root(controllers.RootController):
>         def __init__(self):
>                 super(controllers.RootController,self).__init__()
>                 self.sandboxID = None
>                 self.sandbox_data = None
>                 self.raw_version = ''
>
>         @expose(template="research.templates.index")
>         @error_handler(index)
>         @validate(form=select_sandboxid_form)
>         def index(self,*args,**kwargs):
>                 if VERBOSE:
>                         print '\nStarting "Index"'
>                         print '       args =',args,
>                         print '       kwargs =', kwargs
>                         print '\n'
>
>                 self.homedir = os.getcwd()
>                 if isinstance(self.sandbox_data, sandbox_data):
>                         self.sandbox_data.closeDB()
>                 options = get_sandbox_options()
>                 if DEBUG: print 'Sandbox options values =', options
>                 return
> dict(form=select_sandboxid_form,values=dict(sandboxID=options) ,
>                                                         
> action='/sandbox/metadata')
>
>         @expose(template="research.templates.enter_sandbox_data")
>         def enter_sandbox_data(self, *args, **kwargs):
>                 if VERBOSE:
>                         print '\nStarting "enter_sandbox_data...'
>                         print '       args =',args
>                         print '       kwargs =', kwargs
>                         print '\n'
>                 sd=sandboxes.get(self.sandboxID)
>                 return dict(form=enter_sandbox_data_form, values=sd, action='/
> set_sandbox_data',
>                                                         title='Enter Sandbox 
> Data', id=self.sandboxID)
>
>         @expose()
>         def set_sandbox_data(self,**kwargs):
>                 if VERBOSE:
>                         print '\nStarting "set_sandbox_data...'
>                         print '       kwargs =', kwargs
>                         print '\n'
>                 self.md.update_metadata(**kwargs)
>                 raise redirect('/sandbox')
>
>         @expose(template="research.templates.sandbox")
>         def sandbox(self, *args, **kwargs):
>                 if VERBOSE:
>                         print '\n ==> Entering the sandbox method..'
>                         try: print "     +++ received args:",args
>                         except NameError: pass
>                         try: print "     +++ kwargs:", kwargs
>                         except (NameError, KeyError): pass
>                         print '\n'
>
>                 if args and args[0] == "metadata":
>                         try:
>                                 if kwargs['sandboxID'] == None:
>                                         turbogears.flash("You did not select 
> a sandbox!")
>                                         raise redirect("/index")
>                         except KeyError:
>                                 turbogears.flash("You did not select a 
> sandbox!")
>                                 raise redirect("/index")
>                         self.sandboxID = kwargs['sandboxID']
>                         self.sandbox_data = sandbox_data(self.sandboxID)
>                         self.md=get_sandbox_metadata(self.sandboxID)
>                         sh_desc = self.md.short_description.lower()
>                         if (sh_desc.find('unused') > -1):
>                                 self.md.short_description=""
>                                 self.md.full_description=""
>                                 self.md.researcher_name=''
>                                 self.md.researcher_email=''
>                                 raise redirect("/enter_sandbox_data")
>
>                         raise redirect("/sandbox")
>
>                 #elif args and args[0]=='load_history':
>                         #print "\n==> Received request to load history"
>                         #for key in kwargs:
>                                 #print '\t %s = %s' % (key, kwargs[key])
>                         #print '\n'
>
>                 return dict(metadata=self.md)
>
>         @expose(template="research.templates.select_scores")
>         def select_raw_scores(self,*args,**kwargs):
>                 if DEBUG:
>                         print '\nStarting "select_raw_scores"'
>                         print '       args =',args,
>                         print '       kwargs =', kwargs
>                         print '\n'
>                 if kwargs=={}:
>                         clients_list = get_raw_clients()
>                         return dict(title="RawScores", 
> form1=select_rawscoreclients_form,
>                                                                 
> action1='/select_raw_scores',
> options1=dict(rawScoreClients=clients_list),
>
> size1=dict(rawScoreClients=min(len(clients_list),RAW_CLIENTS_FIELD_SIZE)),
>                                                                 
> form2='',form3='')
>                 if kwargs['field'] == "clients":
>                         self.new_raw_clients = kwargs['rawScoreClients']
>                         if type(self.new_raw_clients) is not ListType:
>                                 self.new_raw_clients = [self.new_raw_clients]
>                         if DEBUG: print '\n The list of RawScore clients = 
> %s' %
> self.new_raw_clients
>                         participant_list =
> get_raw_participants(clients=self.new_raw_clients)
>                         return dict(title="RawScores", 
> form1=select_rawscoreclients_form,
>                                                         action1='',
> options1=dict(rawScoreClients=self.new_raw_clients),
>
> size1=dict(rawScoreClients=min(len(self.new_raw_clients),RAW_CLIENTS_FIELD_SIZE)),
>                                                         
> form2=select_rawscoreparticipants_form, action2='/
> select_raw_scores',
>                                                         
> options2=dict(rawScoreParticipants=participant_list),
>
> size2=dict(rawScoreParticipants=min(len(participant_list),RAW_PARTICIPANTS_FIELD_SIZE)),
>                                                         form3='')
>                 elif kwargs['field'] == "participants":
>                         self.new_raw_participants = 
> kwargs['rawScoreParticipants']
>                         if type(self.new_raw_participants) is not ListType:
>                                 self.new_raw_participants = 
> [self.new_raw_participants]
>                         if DEBUG: print 'The list of RawScore participants = 
> %s \nfor
> clients %s'  % (self.new_raw_participants,self.new_raw_clients)
>                         version_list =  
> get_raw_versions(clients=self.new_raw_clients,
> participants=self.new_raw_participants)
>                         if DEBUG: print '\twith the available versions %s' % 
> version_list
>                         #
>                         # if there are NOT multiple versions for this 
> client/participant
> pair, we MAY be done querying the user:
>                         #
>                         if len(version_list) == 1 :
>                                 #
>                                 # if this is NOT the 1st time we've loaded 
> rawScores AND  the
> version for the requested
>                                 # client/participant does NOT match; Notify 
> the user.
>                                 #
>                                 if DEBUG: print '\ntesting received version 
> list <%s> with
> previous <%s>' % (version_list, self.md.rawscores_type)
>                                 if (self.md.rawscores_type.strip() != '' and 
> version_list.strip() !
> = self.md.rawscores_type.strip()):
>                                         if DEBUG: print 'Attempting to mix 
> versions:  requested version =
> %s; existing  vers = %s' % (version_list, self.md.rawscores_type)
>                                         turbogears.flash("You cannot mix 
> rawScore types in this
> sandbox!!!!")
>                                         raise redirect('/sandbox')
>                                 else:
>                                         self.raw_version = version_list
>                         else:
>                                 #
>                                 # the selected client/participants have 
> multiple versions.
>                                 # If this first time we're loading RawScores, 
> query user for
> preferenct
>                                 #
>                                 if self.md.rawscores_type == '':
>                                         return dict(title="RawScores",
> form1=select_rawscoreclients_form,
>                                                                         
> action1='',
> options1=dict(rawScoreClients=self.new_raw_clients),
>
> size1=dict(rawScoreClients=min(len(self.new_raw_clients),RAW_CLIENTS_FIELD_SIZE)),
>                                                                         
> form2=select_rawscoreparticipants_form, action2='/
> select_raw_scores',
>
> options2=dict(rawScoreParticipants=self.new_raw_participants),
>
> size2=dict(rawScoreParticipants=min(len(self.new_raw_participants),RAW_PARTICIPANTS_FIELD_SIZE)),
>                                                                         
> form3=select_rawscoreversion_form, action3='/
> select_raw_scores',
>                                                                         
> options3=dict(rawScoreVersions=version_list))
>                                 else:
>                                         try:
>                                                 if 
> (version_list.index(self.md.rawscores_type) >= 0):
>                                                         self.raw_version = 
> self.md.rawscores_type
>                                         except ValueError:
>                                                 if DEBUG: print 'Cannot mix 
> versions:  requested version = %s;
> existing  vers = %s' % (version_list, self.md.rawscores_type)
>                                                 turbogears.flash("The 
> selected selected RawScores do match
> already loaded scores!!!!")
>                                                 raise redirect('/sandbox')
>
>                 elif kwargs['field'] == 'versions':
>                         self.raw_version = kwargs['rawScoreVersion']
>
>                 raise redirect('/get_history_data/' + kwargs['hst_src'])
>
>         @expose(template="research.templates.select_scores")
>         def select_dimension_scores(self,*args,**kwargs):
>                 if DEBUG:
>                         print '\nStarting "select_dimension_scores"'
>                         print '       args =',args,
>                         print '       kwargs =', kwargs
>                         print '\n'
>                 if kwargs=={}:
>                         clients_list = get_dim_clients()
>                         return
> dict(title="DimensionScores",form1=select_dimensionscoreclients_form,
> action1='/select_dimension_scores',
>                                                                 
> options1=dict(dimScoreClients=get_dim_clients),
>
> size1=dict(dimScoreClients=min(len(clients_list),DIM_CLIENTS_FIELD_SIZE)),
>                                                                 form2='', 
> form3='')
>
>                 if kwargs['field'] == 'clients':
>                         self.new_dim_clients = kwargs['dimScoreClients']
>                         if type(self.new_dim_clients) is not ListType:
>                                 self.new_dim_clients = [self.new_dim_clients]
>                         if DEBUG: print "\n The list of new clients = %s" %
> self.new_dim_clients
>                         participant_list =
> get_dim_participants(clients=self.new_dim_clients)
>                         if DEBUG: print "   The list of new clients now = %s" 
> %
> self.new_dim_clients
>                         return
> dict(title="DimensionScores",form1=select_dimensionscoreclients_form,
> action1='/select_dimension_scores',
>                                                                 
> options1=dict(dimScoreClients=self.new_dim_clients),
>
> size1=dict(dimScoreClients=min(len(self.new_dim_clients),DIM_CLIENTS_FIELD_SIZE)),
>                                                                 
> form2=select_dimensionscoreparticipants_form, action2='/
> select_dimension_scores',
>                                                                 
> options2=dict(dimScoreParticipants=participant_list),
>
> size2=dict(dimScoreParticipants=min(len(participant_list),DIM_PARTICIPANTS_FIELD_SIZE)),
>                                                                 form3 = '')
>                 elif kwargs['field'] == 'participants':
>                                 self.new_dim_participants = 
> kwargs['dimScoreParticipants']
>                                 if type(self.new_dim_participants) == 
> StringType:
>                                         self.new_dim_participants = 
> [self.new_dim_participants]
>                                 raise redirect 
> ('/get_history_data/'+kwargs['hst_src'])
>
>         @expose(template="research.templates.select_scores")
>         def select_fitness_scores(self,*args,**kwargs):
>                 return dict(form1=select_fitnessscoreclients_form, action1='/
> get_history_data',
>                                                         form2='', form3='',
>                                                         title="FitnessScores")
>
>         @expose()
>         def get_history_data(self,*args,**kwargs):
>                 if DEBUG:
>                         print '\nStarting "get_history_data"'
>                         print '       args =',args,
>                         print '       kwargs =', kwargs
>                         print '\n'
>                 data_src = args[0]
>                 if VERBOSE: print "Fetching %s data from History Service" % 
> data_src
>                 if data_src == "DimensionScores":
>                         hst_docs = hstsvc.get_ScoresHistory(hst_src=data_src,
> ...
>
> read more


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to