Revision e30537f1 snf-astakos-app/astakos/im/functions.py
b/snf-astakos-app/astakos/im/functions.py | ||
---|---|---|
66 | 66 |
PROJECT_MEMBER_JOIN_POLICIES, PROJECT_MEMBER_LEAVE_POLICIES) |
67 | 67 |
from astakos.im.notifications import build_notification, NotificationError |
68 | 68 |
from astakos.im.models import ( |
69 |
AstakosUser, ProjectMembership, ProjectApplication, Project, |
|
69 |
AstakosUser, Invitation, ProjectMembership, ProjectApplication, Project,
|
|
70 | 70 |
PendingMembershipError, get_resource_names, new_chain) |
71 | 71 |
from astakos.im.project_notif import ( |
72 | 72 |
membership_change_notify, membership_enroll_notify, |
... | ... | |
320 | 320 |
inv = Invitation(inviter=inviter, username=email, realname=realname) |
321 | 321 |
inv.save() |
322 | 322 |
send_invitation(inv) |
323 |
inviter.invitations = max(0, self.invitations - 1)
|
|
323 |
inviter.invitations = max(0, inviter.invitations - 1)
|
|
324 | 324 |
inviter.save() |
325 | 325 |
|
326 | 326 |
def switch_account_to_shibboleth(user, local_user, |
... | ... | |
435 | 435 |
return Project.objects.get(name=name) |
436 | 436 |
except Project.DoesNotExist: |
437 | 437 |
raise IOError( |
438 |
_(astakos_messages.UNKNOWN_PROJECT_ID) % project_id)
|
|
438 |
_(astakos_messages.UNKNOWN_PROJECT_ID) % name)
|
|
439 | 439 |
|
440 | 440 |
|
441 | 441 |
def get_project_for_update(project_id): |
... | ... | |
462 | 462 |
try: |
463 | 463 |
return AstakosUser.objects.get(uuid=uuid) |
464 | 464 |
except AstakosUser.DoesNotExist: |
465 |
raise IOError(_(astakos_messages.UNKNOWN_USER_ID) % user_id)
|
|
465 |
raise IOError(_(astakos_messages.UNKNOWN_USER_ID) % uuid)
|
|
466 | 466 |
|
467 | 467 |
def create_membership(project, user): |
468 | 468 |
if isinstance(user, (int, long)): |
Also available in: Unified diff