当前位置: 首页>>代码示例>>Python>>正文


Python Person.put方法代码示例

本文整理汇总了Python中models.Person.put方法的典型用法代码示例。如果您正苦于以下问题:Python Person.put方法的具体用法?Python Person.put怎么用?Python Person.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Person的用法示例。


在下文中一共展示了Person.put方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_new_user

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
    def create_new_user(self, rawname, role, email=""):
        """ Creates a new Person record with a unique username, or returns a person wiht the matching username"""

        ut = Utils()
        username = ut.cleanUserName(rawname)

        if ut.validateUserName(username):

            # check for username
            person = self.get_person(username)

            # create a new person if we have not got this one
            if person == None:
                person = Person()
                person.email = email
                person.passhash = ""
                # no passhash if not got a direct logon
                person.username = username
                person.displayname = ut.tidyUserName(
                    rawname
                )  # allow the username to be updated on the myHoots or profile or summink
                person.before_put()
                person.role = role
                person.put()

            self._person = person

            return username
        else:
            return ""
开发者ID:Carhoots,项目名称:blog,代码行数:32,代码来源:user.py

示例2: post

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
 def post(self):
     email = self.request.get("email")
     name = self.request.get("name")
     person = Person.get_by_key_name(name)
     if not person:
         person = Person(key_name=email, email=email, name=name)
         person.put()
开发者ID:bogo,项目名称:purser,代码行数:9,代码来源:person_controller.py

示例3: post

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
 def post(self):
     continue_uri = self.request.get('continue')
     person = Person()
     person.first_name = self.request.get('first_name')
     person.last_name = self.request.get('last_name')
     person.put()
     self.redirect(continue_uri)
开发者ID:yesudeep,项目名称:tiss-secure,代码行数:9,代码来源:handlers.py

示例4: get

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
 def get(self):
     person = Person(first_name='Pedro',
                     last_name='Perez',
                     email='[email protected]',
                     birth_date=date(1983, 2, 21))
     person.put()
     self.response.write('Inserted Person!')
开发者ID:Eforcers,项目名称:google-dev-courses,代码行数:9,代码来源:views.py

示例5: add_people

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
    def add_people(self, user):
        # Add 10 People
        people = [
            'Nelson Mandella',
            'the Queen of England',
            'the Pope',
            'President Obama',
            'President Obama',
            'Richard Branson',
            'Bill Gates',
            'Warren Buffet',
            'Bon Jovi',
            'Jennifer Aniston'
        ]
        
        self.response.out.write('<hr/>Adding people to meet<hr/>')

        # Get all list items for the current user        
        query = UserListItems.gql('WHERE user = :user', user=user)
        user_list_items = query.get()
        
        if user_list_items is None:
            user_list_items = UserListItems(user=user)

        for name in people:
            # Add Person Entity
            query = Person.gql('WHERE title=:name', name=name)
            person = query.get()

            if person:
                self.response.out.write('Found %s in database<br/>' % person)
            
            if not person:
                person = Person()
                person.title = name
                person.put()
                self.response.out.write('Added %s<br/>' % person)                
            
            # Update the list of items the user has
            if person.key() not in user_list_items.list_items:
                user_list_items.list_items.append(person.key())
                self.response.out.write('Added %s to %s<br/>' % (person.key().to_path(), user_list_items.list_items))            

            # Add the specifics of the user list item linkage
            user_list_item = UserListItem()
            user_list_item.user = user
            user_list_item.list_item = person
            one_year = datetime.timedelta(days=365)
            today = datetime.datetime.today()
            user_list_item.date_due = today + one_year
            user_list_item.put()
            
            ListItemCounter.increment(user_list_item)
            
            self.response.out.write('------------------------------------<br/>')

        # Save the linkages from list items to the current user
        user_list_items.put();
开发者ID:mpurdon,项目名称:Buckets,代码行数:60,代码来源:reset.py

示例6: createUser

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
    def createUser(self, user_info, user, uri):
        # Verifying authenticity of signup request
        if user:
            print "Printing User Info Object"
            print user_info
            requested_role = user_info["role"]
            if users.is_current_user_admin():
                requestee_role = 'admin'
            else:
                requestee_role = self.getCurrentUserRole(user)[0]
            
            print requestee_role
            print requested_role
            
            if requestee_role == 'superintendent' and requested_role not in ['principal','teacher','student']:
                return {
                    'error': 'User does not have permissions to create that role'
                }
            elif requestee_role == 'principal' and requested_role not in ['teacher', 'student']:
                return {
                    'error': 'User does not have permissions to create that role'
                }
            elif requestee_role == 'teacher' and requested_role  not in ['student']:
                return {
                    'error': 'User does not have permissions to create that role'
                }
            elif requestee_role == False:
                return {
                    'error': 'User does not have permissions to create that role'
                }
            else:
                # Check to see if user already exists
                try:    
                    email = user_info.email
                    query = Person.query(Person.email == email)
                    person = query.fetch(1)
                    person = person[0]
                    print person
                    if person:
                        print "User already exists..."
                        return {
                            'error': 'User already exists'
                        }

                except:
                    print "Creating User..."
                    guid = str(uuid4())
                    f_name = user_info["f_name"]
                    l_name = user_info["l_name"]
                    
                    person = Person(f_name=f_name, l_name=l_name, email=user_info["email"], role=[user_info["role"]], guid=guid)
                    person.put()
                    # self.sendEmail(f_name, l_name, user_info["email"], guid, uri)
                    return person
        else:
            return {
                'error': 'No user logged in'
            }
开发者ID:Bale96,项目名称:educationalGames,代码行数:60,代码来源:SignUpController.py

示例7: get_person_by_email

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
def get_person_by_email(email):
    """Helper method to get the Person object corresponding to the given email.
    Creates a new Person object if one didn't exist already.
    """
    person = Person.get_by_id(email, parent=get_parent_key_from_email(email))
    logging.info("person = " + str(person)) 
    if not person:
        logging.info("Failed to find person by id, creating new user")
        # DONE: Create a new person with the id = email and parent of get_parent_key_from_email
        person = Person(parent=get_parent_key_from_email(email),
                    id=email)
        person.put()
    return person
开发者ID:fanghuang,项目名称:Booksharepoint,代码行数:15,代码来源:person_utils.py

示例8: dispatch_request

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
	def dispatch_request(self):
		Usr = users.get_current_user()
		if Usr.email() == '[email protected]' or Usr.email() == '[email protected]':
			parties = Party.query()
			persons = Person.query()
			p = request.args.get('p', '')				
			if not p:
				form = PartyForm()
				if form.validate_on_submit():
					party = Party(name=form.name.data,code=gen_code(),email=form.email.data,
							phone=form.phone.data, address={ 'street':form.street.data, 'zip':form.zip.data,
							'suite': form.suite.data, 'city':form.city.data, 'state':form.state.data, } )
					party.put()
					p = party.key.id()
					#request.post(p=p)
					#return redirect(url_for('index'))
					return render_template('admin.html', pid=p,form=PersonForm(),parties=parties,persons=persons,
							Party=Party,Person=Person)
				return render_template('admin.html',pid=p,form=form,parties=parties,persons=persons,
						Party=Party,Person=Person)
			else:
				form = PersonForm()
				p = int(p)
				if form.validate_on_submit():
					person = Person(title=form.title.data,first=form.first.data,last=form.last.data,
							food=form.food.data, rsvp='a', party=form.party.data)
					person.put()
					ps = person.key.id()
					return redirect(url_for('admin', p=p))
					return render_template('admin.html',pid=p,form=form,parties=parties,
							persons=persons, Party=Party,Person=Person)
				return render_template('admin.html',pid=p,form=form,parties=parties,
							persons=persons, Party=Party,Person=Person)
		else:
			flash(u'Sorry, no admission!')
			return redirect(url_for('rsvp'))
开发者ID:mad-magic,项目名称:src,代码行数:38,代码来源:views_all.py

示例9: create_person_txn

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
def create_person_txn(email):
  key = Person.key_for(email)
  p = db.get(key)
  if not p:
    p = Person(key_name=key.name(), user=users.User(email))
    p.put()
开发者ID:B-Rich,项目名称:crashkit,代码行数:8,代码来源:accountedit.py

示例10: create_person

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import put [as 别名]
 def create_person(self, request):
     authorise(request.person, request.token)
     mm = Person(name=request.name, email=request.email, parentId=request.parentId);
     res = PersonMsg(id=mm.put().id(), name=request.name, email=request.email, parentId=request.parentId)
     return res
开发者ID:ShyAlon,项目名称:herex,代码行数:7,代码来源:meetingsApi.py


注:本文中的models.Person.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。