def edit_permission(request, app=None, priv=None):
 if (not request.user.is_superuser):
  request.audit = {'operation': 'EDIT_PERMISSION', 'operationText': _get_failed_operation_text(request.user.username, 'EDIT_PERMISSION'), 'allowed': False}
  raise PopupException(_('You must be a superuser to change permissions.'), error_code=401)
 instance = HuePermission.objects.get(app=app, action=priv)
 if (request.method == 'POST'):
  form = PermissionsEditForm(request.POST, instance=instance)
  if form.is_valid():
   form.save()
   request.info(_('Permission information updated'))
   request.audit = {'operation': 'EDIT_PERMISSION', 'operationText': ('Successfully edited permissions: %(app)s/%(priv)s' % {'app': app, 'priv': priv})}
   return redirect(reverse(list_permissions))
 else:
  form = PermissionsEditForm(instance=instance)
 return render('edit_permissions.mako', request, dict(form=form, action=request.path, app=app, priv=priv))

def edit_permission ( request , app = None , priv = None ) : if ( not request . user . is_superuser ) : request . audit = { 'operation' : 'EDIT_PERMISSION' , 'operationText' : _get_failed_operation_text ( request . user . username , 'EDIT_PERMISSION' ) , 'allowed' : False } raise PopupException ( _ ( 'You must be a superuser to change permissions.' ) , error_code = 401 ) instance = HuePermission . objects . get ( app = app , action = priv ) if ( request . method == 'POST' ) : form = PermissionsEditForm ( request . POST , instance = instance ) if form . is_valid ( ) : form . save ( ) request . info ( _ ( 'Permission information updated' ) ) request . audit = { 'operation' : 'EDIT_PERMISSION' , 'operationText' : ( 'Successfully edited permissions: %(app)s/%(priv)s' % { 'app' : app , 'priv' : priv } ) } return redirect ( reverse ( list_permissions ) ) else : form = PermissionsEditForm ( instance = instance ) return render ( 'edit_permissions.mako' , request , dict ( form = form , action = request . path , app = app , priv = priv ) )
edit_permission -> reply @type request: httprequest .