Changeset 2061

Show
Ignore:
Timestamp:
06/23/09 13:01:48 (9 months ago)
Author:
JensDiemer
Message:

work-a-round in unittest login function, but FIXME: Why does in some case user.get_profile() not work???

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.9/pylucid_project/tests/test_tools/basetest.py

    r2040 r2061  
    104104        site = Site.objects.get_current() 
    105105        user = self._get_user(usertype="normal") 
    106         userprofile = user.get_profile() 
     106         
     107        from pylucid.models import UserProfile 
     108        try: 
     109            userprofile = user.get_profile() 
     110        except UserProfile.DoesNotExist: 
     111            # FIXME: Why does in some case user.get_profile() not work??? 
     112            userprofile = UserProfile.objects.get(user=user) 
    107113         
    108114        if not site in userprofile.site.all():