Not sure if there is a better way to do this, but I have a page to register on my site, and after the user signs up, I add my original data (material in the __init__ data model), then I start adding some other info to the same section that gives me a broken pipe error. Oddly enough, the code works because the records I expect are in the database. I tried navigating the .flush() command to see if it helps, but that doesn't seem to be the case.
Traceback (most recent call last): File "/Users/me/Dropbox/code/eclipseWorkSpace/website/pyramidwiki/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/channel.py", line 134, in handle_write flush() File "/Users/me/Dropbox/code/eclipseWorkSpace/website/pyramidwiki/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/channel.py", line 249, in _flush_some num_sent = self.send(chunk) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 365, in send result = self.socket.send(data) error: [Errno 32] Broken pipe
Here is my code:
if 'form.submitted' in request.params: firstname = request.params['firstname'] lastname = request.params['lastname'] email = request.params['email'] password = request.params['password'] try: new_user = Users(email, firstname, lastname, password) DBSession.add(new_user) #DBSession.flush() #commit so we get error if any #add some other info user_data = DBSession.query(Users).filter(Users.email==email).first() user_data.join_date = datetime.datetime.now() #create random number for verification url user_data.vertified = id_generator(50) DBSession.flush() #doesn't seem to make a difference where the flush is return HTTPFound(location = request.route_url('new'))
Any ideas?
source share