1434 edited.check() |
1434 edited.check() |
1435 try: |
1435 try: |
1436 source.update_entity(session, entity) |
1436 source.update_entity(session, entity) |
1437 edited.saved = True |
1437 edited.saved = True |
1438 except UniqueTogetherError as exc: |
1438 except UniqueTogetherError as exc: |
1439 etype, rtypes = exc.args |
1439 userhdlr = session.vreg['adapters'].select( |
1440 problems = {} |
1440 'IUserFriendlyError', session, entity=entity, exc=exc) |
1441 for col in rtypes: |
1441 userhdlr.raise_user_exception() |
1442 problems[col] = session._('violates unique_together constraints (%s)') % (','.join(rtypes)) |
|
1443 raise ValidationError(entity.eid, problems) |
|
1444 self.system_source.update_info(session, entity, need_fti_update) |
1442 self.system_source.update_info(session, entity, need_fti_update) |
1445 if source.should_call_hooks: |
1443 if source.should_call_hooks: |
1446 if not only_inline_rels: |
1444 if not only_inline_rels: |
1447 hm.call_hooks('after_update_entity', session, entity=entity) |
1445 hm.call_hooks('after_update_entity', session, entity=entity) |
1448 for attr, value, prevvalue in relations: |
1446 for attr, value, prevvalue in relations: |