Project

General

Profile

Revision 5edd29ac

ID5edd29aca0063b35787675c749966b6b296ef533
Parent 4d0f5398
Child fcef64e8

Added by Vincent QUEMENER over 14 years ago

Correction d'un bug dans la vérification des changements survenus depuis la génération de la page.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@1935 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

vigiboard/controllers/root.py
431 431
        # Le filtre permet d'éliminer les chaines vides contenues dans le
432 432
        # tableau ('a,b,' -> split -> ['a','b',''] -> filter -> ['a','b']).
433 433
        ids = filter(len, krgv['id'].split(','))
434
        
435
        # Si des changements sont survenus depuis que la 
436
        # page est affichée, on en informe l'utilisateur.
437
        last_modification = get_last_modification_timestamp(ids, None)
438
        if last_modification and datetime.fromtimestamp(\
439
            float(krgv['last_modification'])) < last_modification:
440
            flash(_('Changes have occurred since the page was last displayed, '
441
                    'your changes HAVE NOT been saved.'), 'warning')
442
            raise redirect(request.environ.get('HTTP_REFERER', url('/')))
443 434

  
444 435
        # Si l'utilisateur édite plusieurs événements à la fois,
445 436
        # il nous faut chacun des identifiants
......
455 446
            Event.idsupitem == events.items.c.idsupitem))
456 447
        events.add_filter(CorrEvent.idcorrevent.in_(ids))
457 448
        
449
        events.generate_request()
450
        idevents = [cause.idcause for cause in events.req]
451
        # Si des changements sont survenus depuis que la 
452
        # page est affichée, on en informe l'utilisateur.
453
        last_modification = get_last_modification_timestamp(idevents, None)
454
        if last_modification and datetime.fromtimestamp(\
455
            float(krgv['last_modification'])) < last_modification:
456
            flash(_('Changes have occurred since the page was last displayed, '
457
                    'your changes HAVE NOT been saved.'), 'warning')
458
            raise redirect(request.environ.get('HTTP_REFERER', url('/')))
459
        
458 460
        # Vérification que au moins un des identifiants existe et est éditable
459 461
        if events.num_rows() <= 0 :
460 462
            flash(_('No access to this event'), 'error')

Also available in: Unified diff