Ejemplo n.º 1
0
	def create_user(self, name, email):
		from accounts.methods import register_user, register_qt, register_account
		logging.info('Creating New User With Nickname %s', name)
		this_user = {}
		this_user['nickname'] = name
		this_user['fullname'] = this_user['nickname']
		this_user['email'] = email
		this_user['unique_identifier'] = str(name)
		this_user['account'] = register_account(this_user['unique_identifier'], this_user['nickname'])
		this_user['user'] = register_user(this_user['unique_identifier'], this_user['nickname'], this_user['fullname'], this_user['email'])
		this_user['quiz_taker'] = register_qt(this_user['unique_identifier'], this_user['nickname'])
		print this_user['account'].unique_identifier, this_user['user'].unique_identifier, this_user['quiz_taker'].unique_identifier
		return this_user['account'], this_user['user'], this_user['quiz_taker']
Ejemplo n.º 2
0
Archivo: views.py Proyecto: jamslevy/PQ
  def get(self):
	# Now prepared.html contains the full google checkout button html
	account = Account.get_by_key_name(self.session['user'])
	account.pass_count = 1
	account.put()
	try: pass_count = account.pass_count
	except: # no pass count yet
	    try: 
	        account.pass_count = 1      # this is just to upgrade model.
	        pass_count = account.pass_count
	    except: 
	        from accounts.methods import register_account
	        register_account(self.session['user'])
	        account = Account.get_by_key_name(self.session['user'])
	        account.pass_count = 1
	        pass_count = account.pass_count
	        # take previous block out
	        
	         
	    account.put()
	test = self.get_test()
	template_values = {'pass_count': pass_count}
	path = tpl_path(STORE_PATH +'take_test.html')
	self.response.out.write(template.render(path, template_values))
Ejemplo n.º 3
0
 def create_business_account(self, uid, email, proficiencies=False, batch=False):
   from accounts.methods import register_account, register_user
   import string
   try:
       int(uid[0]) #check to see if it starts with an integer
       uid = "pq" + uid
   except ValueError: pass #doesnt start with integer	
   fullname = string.capwords(uid.replace("_", " "))
   business_employer = self.register_employer(uid, fullname, email, proficiencies, save=False)
   if not business_employer: return () # already registered
   business_account = register_account(uid, fullname, save=False)
   business_profile = register_user(uid, fullname, fullname, email, is_sponsor=True, save=False)
   if business_profile.is_sponsor is False: return "ERROR"
   if not batch: #only one account being made
       db.put([business_account, business_profile, business_employer])
       self.refresh_employer_images([business_employer])
   return business_account, business_profile, business_employer 
Ejemplo n.º 4
0
Archivo: views.py Proyecto: jamslevy/PQ
 def create_user(self):
       save = []
       if not self.request.get('nickname') and self.request.get('email'):
           self.response.out.write('nickname and email required')
           return 
       logging.info('Creating New User With Nickname %s', self.request.get('nickname'))
       try:
           int(self.session['unique_identifier'][0]) #check to see if it starts with an integer. key_names cant start with number.
           self.session['unique_identifier'] = "pq" + self.session['unique_identifier']
       except ValueError: pass #doesnt start with integer
       self.session['nickname'] = self.request.get('nickname')
       if not self.session['fullname']: self.session['fullname'] = self.session['nickname']
       self.session['email'] = self.request.get('email')
       self.session['account'] = register_account(self.session['unique_identifier'], self.session['nickname'], save=False)
       self.session['user'] = register_user(self.session['unique_identifier'], self.session['nickname'], self.session['fullname'], self.session['email'], save=False)
       self.session['quiz_taker'] = register_qt(self.session['unique_identifier'], self.session['nickname'], save=False)
       save.extend( (self.session['account'], self.session['user'], self.session['quiz_taker']) ) 
       db.put(save)
       from accounts.mail import mail_intro_message
       mail_intro_message(self.session['user'])
       self.redirect('/login')