If it helps at all, here's the controller function that creates and processes the form:
def dupAndEdit(): """Create and process a form to insert a new record, pre-populated with field values copied from an existing record.""" tablename = request.args[0] rowid = request.args[1] orderby = request.vars['orderby'] or 'id' restrictor = request.vars['restrictor'] or None formname = '%s/%s/dup' % (tablename, rowid) src = db(db[tablename].id == rowid).select().first() form = SQLFORM(db[tablename], separator='', showid=True, formstyle='ul') for v in db[tablename].fields: # on opening populate duplicate values form.vars[v] = src[v] if v != 'id' and v in src else None # FIXME: ajaxselect field values have to be added manually if db[tablename].fields[1] in request.vars.keys(): # on submit add ajaxselect values extras = [f for f in db[tablename].fields if f not in form.vars.keys()] for e in extras: form.vars[e] = request.vars[e] if e in request.vars.keys() \ else '' del form.vars['id'] print 'form vars =========================================' pprint(form.vars) if form.process(formname=formname).accepted: db.commit() print 'accepted form =================================' the_url = makeurl(tablename, orderby, restrictor) response.js = "web2py_component('%s', " \ "'listpane');" % the_url response.flash = 'New record successfully created.' elif form.errors: print 'listandedit form errors:', [e for e in form.errors] print 'listandedit form vars:', form.vars response.flash = 'Sorry, there was an error processing '\ 'the form. The new record has not been created.' else: pass return dict(form=form) On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote: > > what about if you start a shell and issue the insert statement with a > db.commit() ? does it hang also there ? > > On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote: >> >> Oh, and I'm running version 2.9.11-stable. >> >> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote: >>> >>> I have a create form (SQLFORM) that works (a new record is actually >>> created) but immediately after inserting the new record the web2py process >>> hangs. The form remains greyed out and no other functions will work (e.g., >>> can't refresh the page or navigate away). But there's no error raised. Can >>> anyone help me figure out what is causing the hang? >>> >>> I've pinpointed the point where the hang occurs: the call to >>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the >>> current stable version). What's strange is that the Table.insert method >>> does finish without any errors. But when it returns to SQLFORM.accepts the >>> execution hangs. A print statement immediately following the call to >>> Table.insert is not executed. >>> >>> If it helps to know, I'm using postgresql running on apache. >>> >>> Here is an example of the data being sent by SQLFORM.accepts to >>> Table.insert: >>> >>> {'hints': [], >>> 'instructions': [13L, 14L], >>> 'lemmas': [], >>> 'locations': [11L], >>> 'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32), >>> 'npcs': [32L], >>> 'outcome1': '1.0', >>> 'outcome2': '', >>> 'outcome3': '', >>> 'prompt': 'Repetition can serve to emphasize certain words in the >>> sentence, especially when the repeated words are close together. Which >>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 >>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 >>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 >>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 >>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf >>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd >>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."', >>> 'prompt_audio': 1, >>> 'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd', >>> 'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( >>> \xe1\xbc\xa0\xce\xbd)?$', >>> 'response2': '', >>> 'response3': '', >>> 'status': 1, >>> 'step_options': [], >>> 'tags': [202L], >>> 'tags_ahead': [], >>> 'tags_secondary': [], >>> 'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170', >>> 'widget_image': 9, >>> 'widget_type': 1} >>> >>> Again, the db record is actually created. The operation just stops any >>> further execution. >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.