def get_valid_user(user=None):
 if (user is None):
  theuser = get_default_user()
 elif isinstance(user, basestring):
  theuser = get_user_model().objects.get(username=user)
 elif (user == user.get_anonymous()):
  raise GeoNodeException('The user uploading files must not be anonymous')
 else:
  theuser = user
 assert isinstance(theuser, get_user_model())
 return theuser

def get_valid_user ( user = None ) : if ( user is None ) : theuser = get_default_user ( ) elif isinstance ( user , basestring ) : theuser = get_user_model ( ) . objects . get ( username = user ) elif ( user == user . get_anonymous ( ) ) : raise GeoNodeException ( 'The user uploading files must not be anonymous' ) else : theuser = user assert isinstance ( theuser , get_user_model ( ) ) return theuser
gets the default user or creates it if it does not exist .