Revision f12bcb3d snf-astakos-app/astakos/im/views/projects.py

b/snf-astakos-app/astakos/im/views/projects.py
63 63
    reject_membership, remove_membership, cancel_membership, leave_project, \
64 64
    join_project, enroll_member, can_join_request, can_leave_request, \
65 65
    get_related_project_id, approve_application, \
66
    deny_application, cancel_application, dismiss_application
66
    deny_application, cancel_application, dismiss_application, ProjectError
67 67
from astakos.im import settings
68 68
from astakos.im.util import redirect_back
69 69
from astakos.im.views.util import render_response, _create_object, \
......
135 135
            form_class=ProjectApplicationForm,
136 136
            msg=_("The %(verbose_name)s has been received and "
137 137
                  "is under consideration."))
138
    except (IOError, PermissionDenied) as e:
138
    except ProjectError as e:
139 139
        messages.error(request, e)
140 140

  
141 141

  
......
187 187
        application_id = int(application_id)
188 188
        chain_id = get_related_project_id(application_id)
189 189
        cancel_application(application_id, request.user)
190
    except (IOError, PermissionDenied), e:
190
    except ProjectError as e:
191 191
        messages.error(request, e)
192 192

  
193 193
    else:
......
265 265
            form_class=ProjectApplicationForm,
266 266
            msg=_("The %(verbose_name)s has been received and is under "
267 267
                  "consideration."))
268
    except (IOError, PermissionDenied) as e:
268
    except ProjectError as e:
269 269
        messages.error(request, e)
270 270

  
271 271

  
......
292 292
                                        u,
293 293
                                        request_user=request.user),
294 294
                addmembers_form.valid_users)
295
        except (IOError, PermissionDenied), e:
295
        except ProjectError as e:
296 296
            messages.error(request, e)
297 297

  
298 298

  
......
475 475
        else:
476 476
            m = _(astakos_messages.USER_JOIN_REQUEST_SUBMITTED)
477 477
        messages.success(request, m)
478
    except (IOError, PermissionDenied), e:
478
    except ProjectError as e:
479 479
        messages.error(request, e)
480 480

  
481 481

  
......
504 504
        else:
505 505
            m = _(astakos_messages.USER_LEAVE_REQUEST_SUBMITTED)
506 506
        messages.success(request, m)
507
    except (IOError, PermissionDenied), e:
507
    except ProjectError as e:
508 508
        messages.error(request, e)
509 509

  
510 510

  
......
529 529
        cancel_membership(memb_id, request.user)
530 530
        m = _(astakos_messages.USER_REQUEST_CANCELLED)
531 531
        messages.success(request, m)
532
    except (IOError, PermissionDenied), e:
532
    except ProjectError as e:
533 533
        messages.error(request, e)
534 534

  
535 535

  
......
549 549
    try:
550 550
        memb_id = int(memb_id)
551 551
        m = accept_membership(memb_id, request.user)
552
    except (IOError, PermissionDenied), e:
552
    except ProjectError as e:
553 553
        messages.error(request, e)
554 554

  
555 555
    else:
......
574 574
    try:
575 575
        memb_id = int(memb_id)
576 576
        m = remove_membership(memb_id, request.user)
577
    except (IOError, PermissionDenied), e:
577
    except ProjectError as e:
578 578
        messages.error(request, e)
579 579
    else:
580 580
        email = escape(m.person.email)
......
598 598
    try:
599 599
        memb_id = int(memb_id)
600 600
        m = reject_membership(memb_id, request.user)
601
    except (IOError, PermissionDenied), e:
601
    except ProjectError as e:
602 602
        messages.error(request, e)
603 603
    else:
604 604
        email = escape(m.person.email)

Also available in: Unified diff