def setupOpen(pop): #SETUP ABANDONED PROFILES if pop > 1: populate(pop) #profiles = Profile.objects.all() #for p in profiles: # makeFriends(p) #SETUP TAGS for t in initialTags(): d = Tag(name=t) d.save() #MAKE RANGER ranger = Profile( fname='Ranger', lname='Lyman', gender=Gender.female, age=30, location='Indianapolis, Indiana', last_login=timezone.now(), species=Species.system, img_number=1, energy=1983, visible=True ) ranger.save() rangerPost = "Thank you for visiting the openspace wilderness. I am here to assist you as well as post occasional updates and additional info about the park. Have fun exploring, and be careful out there in the wilds." makeTaggedPost(ranger, rangerPost, 'protected') #SEED Visitor makeAnonymous() #SEED PREY PROFILES for p in initialPreyProfiles(): newProfile = Profile( fname=p['fname'], lname=p['lname'], gender=p['gender'], age=p['age'], location=p['location'], last_login=timezone.now(), species=Species.forager, energy=System.energy, visible=False ) newProfile.save() assignImages(newProfile) makeBirthPost(newProfile)
def process_request(self, request): if 'new_session' not in request.session or request.session['new_session']: is_human = False if 'session_anon' in request.session: entry_user = Profile.objects.get(id=request.session['session_anon']) if 'is_human' in request.session: is_human = request.session['is_human'] if is_human: entry_user = profileHelpers.makeAnonymous() request.session['session_anon'] = entry_user.id else: entry_user = Profile.objects.filter(species=Species.visitor).order_by('?')[0] #rando to get in the door request.session.flush() entry_nav_profile = Profile.objects.filter(species=Species.abandoned).order_by('?')[0] request_defaults = ( ('new_session', False), ('session_anon', entry_user.id), ('is_human', is_human), ('page_background', siteHelpers.bgSelect(666)), ('page_banner', siteHelpers.bannerSelect(666)), ('session_id', entry_user.id), ('session_species', entry_user.species), ('session_death', False), ('selected_trail', 'no'), ('nav_id', entry_nav_profile.id), ('nav_position', entry_nav_profile.position), ('session_lock', False), ('profile_interest_collection', str(entry_user.id)), ('post_interest_collection', ''), ('notification', None) ) for k, v in request_defaults: request.session.setdefault(k, v)