def handle_merge(translation, request, next_unit_url):
 if (not can_translate(request.user, translation)):
  messages.error(request, _(u"You don't have privileges to save translations!"))
  return
 mergeform = MergeForm(translation, request.GET)
 if (not mergeform.is_valid()):
  messages.error(request, _(u'Invalid merge request!'))
  return
 unit = mergeform.cleaned_data[u'unit']
 merged = Unit.objects.get(pk=mergeform.cleaned_data[u'merge'])
 if (unit.checksum != merged.checksum):
  messages.error(request, _(u'Can not merge different messages!'))
 else:
  unit.target = merged.target
  unit.fuzzy = merged.fuzzy
  saved = unit.save_backend(request)
  if saved:
   request.user.profile.translated += 1
   request.user.profile.save()
  return HttpResponseRedirect(next_unit_url)

def handle_merge ( translation , request , next_unit_url ) : if ( not can_translate ( request . user , translation ) ) : messages . error ( request , _ ( u"You don't have privileges to save translations!" ) ) return mergeform = MergeForm ( translation , request . GET ) if ( not mergeform . is_valid ( ) ) : messages . error ( request , _ ( u'Invalid merge request!' ) ) return unit = mergeform . cleaned_data [ u'unit' ] merged = Unit . objects . get ( pk = mergeform . cleaned_data [ u'merge' ] ) if ( unit . checksum != merged . checksum ) : messages . error ( request , _ ( u'Can not merge different messages!' ) ) else : unit . target = merged . target unit . fuzzy = merged . fuzzy saved = unit . save_backend ( request ) if saved : request . user . profile . translated += 1 request . user . profile . save ( ) return HttpResponseRedirect ( next_unit_url )
handles unit merging .