Revision e30537f1
b/snf-astakos-app/astakos/im/api/backends/lib/django/__init__.py | ||
---|---|---|
174 | 174 |
try: |
175 | 175 |
user.add_resource_policy(**p) |
176 | 176 |
except (ObjectDoesNotExist, IntegrityError), e: |
177 |
append((service, resource, e))
|
|
177 |
append((p.get('service'), p.get('resource'), e))
|
|
178 | 178 |
return rejected |
179 | 179 |
|
180 | 180 |
@safe |
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)): |
b/snf-astakos-app/astakos/im/notifications.py | ||
---|---|---|
55 | 55 |
self, sender, recipients, subject, |
56 | 56 |
message=None, template=None, dictionary=None): |
57 | 57 |
if not message and not template: |
58 |
raise InputError('message and template cannot be both None.')
|
|
58 |
raise IOError('message and template cannot be both None.')
|
|
59 | 59 |
dictionary = dictionary or {} |
60 | 60 |
self.sender = sender |
61 | 61 |
self.recipients = recipients |
b/snf-pithos-app/pithos/api/public.py | ||
---|---|---|
38 | 38 |
|
39 | 39 |
from synnefo.lib.astakos import get_user |
40 | 40 |
|
41 |
from pithos.api.faults import (Fault, BadRequest, ItemNotFound) |
|
41 |
from pithos.api.faults import (Fault, BadRequest, ItemNotFound, NotModified)
|
|
42 | 42 |
from pithos.api.util import (put_object_headers, update_manifest_meta, |
43 |
validate_modification_preconditions, validate_matching_preconditions, |
|
44 |
object_data_response, api_method) |
|
43 |
validate_modification_preconditions, |
|
44 |
validate_matching_preconditions, |
|
45 |
object_data_response, api_method, |
|
46 |
split_container_object_string) |
|
45 | 47 |
from pithos.api.short_url import decode_url |
46 | 48 |
from pithos.api.settings import AUTHENTICATION_URL, AUTHENTICATION_USERS |
47 | 49 |
|
Also available in: Unified diff