def handle(self, request):
try:
c = CognateClass.objects.get(id=self.data['id'])
if c.isChanged(**self.data):
with transaction.atomic():
try:
problem = c.setDelta(**self.data)
if problem is None:
c.save()
else:
messages.error(request, c.deltaReport(**problem))
except Exception:
logging.exception(
'Exception handling CognateClassEditForm.')
messages.error(
request,
'Sorry, the server had problems '
'updating the cognate set.')
except CognateClass.DoesNotExist:
logging.exception('Cognate class does not exist in database.')
messages.error(
request,
"Sorry, cognate class %s does not exist on the server." %
self.data['id'])
评论列表
文章目录