Commit 6ddf3a48 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Bug fixing

parent cfe3309e
......@@ -174,7 +174,7 @@ class DjangoBackend(BaseBackend):
try:
user.add_resource_policy(**p)
except (ObjectDoesNotExist, IntegrityError), e:
append((service, resource, e))
append((p.get('service'), p.get('resource'), e))
return rejected
@safe
......
......@@ -66,7 +66,7 @@ from astakos.im.settings import (
PROJECT_MEMBER_JOIN_POLICIES, PROJECT_MEMBER_LEAVE_POLICIES)
from astakos.im.notifications import build_notification, NotificationError
from astakos.im.models import (
AstakosUser, ProjectMembership, ProjectApplication, Project,
AstakosUser, Invitation, ProjectMembership, ProjectApplication, Project,
PendingMembershipError, get_resource_names, new_chain)
from astakos.im.project_notif import (
membership_change_notify, membership_enroll_notify,
......@@ -320,7 +320,7 @@ def invite(inviter, email, realname):
inv = Invitation(inviter=inviter, username=email, realname=realname)
inv.save()
send_invitation(inv)
inviter.invitations = max(0, self.invitations - 1)
inviter.invitations = max(0, inviter.invitations - 1)
inviter.save()
def switch_account_to_shibboleth(user, local_user,
......@@ -435,7 +435,7 @@ def get_project_by_name(name):
return Project.objects.get(name=name)
except Project.DoesNotExist:
raise IOError(
_(astakos_messages.UNKNOWN_PROJECT_ID) % project_id)
_(astakos_messages.UNKNOWN_PROJECT_ID) % name)
def get_project_for_update(project_id):
......@@ -462,7 +462,7 @@ def get_user_by_uuid(uuid):
try:
return AstakosUser.objects.get(uuid=uuid)
except AstakosUser.DoesNotExist:
raise IOError(_(astakos_messages.UNKNOWN_USER_ID) % user_id)
raise IOError(_(astakos_messages.UNKNOWN_USER_ID) % uuid)
def create_membership(project, user):
if isinstance(user, (int, long)):
......
......@@ -55,7 +55,7 @@ class Notification(object):
self, sender, recipients, subject,
message=None, template=None, dictionary=None):
if not message and not template:
raise InputError('message and template cannot be both None.')
raise IOError('message and template cannot be both None.')
dictionary = dictionary or {}
self.sender = sender
self.recipients = recipients
......
......@@ -38,10 +38,12 @@ from django.views.decorators.csrf import csrf_exempt
from synnefo.lib.astakos import get_user
from pithos.api.faults import (Fault, BadRequest, ItemNotFound)
from pithos.api.faults import (Fault, BadRequest, ItemNotFound, NotModified)
from pithos.api.util import (put_object_headers, update_manifest_meta,
validate_modification_preconditions, validate_matching_preconditions,
object_data_response, api_method)
validate_modification_preconditions,
validate_matching_preconditions,
object_data_response, api_method,
split_container_object_string)
from pithos.api.short_url import decode_url
from pithos.api.settings import AUTHENTICATION_URL, AUTHENTICATION_USERS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment