
from account.models import Account, AnonymousAccount

def openid(request):
    return {'openid': request.openid}

def account(request):
    if request.user.is_authenticated():
        try:
            account = Account._default_manager.get(user=request.user)
        except (Account.DoesNotExist, Account.MultipleObjectsReturned):
            account = AnonymousAccount(request)
    else:
        account = AnonymousAccount(request)
    return {'account': account}


from account.models import Account, AnonymousAccount

def openid(request):
    return {'openid': request.openid}

def account(request):
    if request.user.is_authenticated():
        try:
            account = Account._default_manager.get(user=request.user)
        except Account.DoesNotExist:
            account = AnonymousAccount(request)
    else:
        account = AnonymousAccount(request)
    return {'account': account}

Throw 500 error on multiple accounts in account context processor
Throw 500 error on multiple accounts in account context processor

  
  from account.models import Account, AnonymousAccount
  
  def openid(request):
      return {'openid': request.openid}
  
  def account(request):
      if request.user.is_authenticated():
          try:
              account = Account._default_manager.get(user=request.user)
-         except (Account.DoesNotExist, Account.MultipleObjectsReturned):
+         except Account.DoesNotExist:
              account = AnonymousAccount(request)
      else:
          account = AnonymousAccount(request)
      return {'account': account}
  
Throw 500 error on multiple accounts in account context processor
## Code Before:

from account.models import Account, AnonymousAccount

def openid(request):
    return {'openid': request.openid}

def account(request):
    if request.user.is_authenticated():
        try:
            account = Account._default_manager.get(user=request.user)
        except (Account.DoesNotExist, Account.MultipleObjectsReturned):
            account = AnonymousAccount(request)
    else:
        account = AnonymousAccount(request)
    return {'account': account}

## Instruction:
Throw 500 error on multiple accounts in account context processor
## Code After:

from account.models import Account, AnonymousAccount

def openid(request):
    return {'openid': request.openid}

def account(request):
    if request.user.is_authenticated():
        try:
            account = Account._default_manager.get(user=request.user)
        except Account.DoesNotExist:
            account = AnonymousAccount(request)
    else:
        account = AnonymousAccount(request)
    return {'account': account}
