On 24 April 2012 15:41, Johann Spies <johann.sp...@gmail.com> wrote: > On 13 April 2012 21:46, Richard Vézina <ml.richard.vez...@gmail.com>wrote: > >> This solution look great, because until now web2py was triggering a error >> if postgres return not unique and won't insert the data... >> >> > This problem has bitten me again. My previous test was in the console. > Now in a controller I did the following: > > def koppel_skrywer_artikel(): > response.view = 'default/edit_journal.html' > opskrif = CENTER(H2(T('Add link between author and article'))) > form=SQLFORM.factory(db.akb_authors_article_link) > if form.process().accepted: > try: > db.akb_authors_article_link.insert(**form.vars) > response.flash = T('Link inserted in database') > db.commit() > else: >
And that was my problem. Apology for the noise on the list. With 'except' in stead of 'else:'(typo), it works as expected. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)