
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):
    account = AnonymousAccount(request)
    if request.user.is_authenticated():
        try:
            account = Account._default_manager.get(user=request.user)
        except (Account.DoesNotExist, Account.MultipleObjectsReturned):
            account = None
    return {'account': account}

--- 
+++ 
@@ -5,10 +5,11 @@
     return {'openid': request.openid}
 
 def account(request):
-    account = AnonymousAccount(request)
     if request.user.is_authenticated():
         try:
             account = Account._default_manager.get(user=request.user)
         except (Account.DoesNotExist, Account.MultipleObjectsReturned):
-            account = None
+            account = AnonymousAccount(request)
+    else:
+        account = AnonymousAccount(request)
     return {'account': account}
Handle the exception case in the account context_processor.

git-svn-id: 51ba99f60490c2ee9ba726ccda75a38950f5105d@1119 45601e1e-1555-4799-bd40-45c8c71eef50
