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


Python Person.email方法代码示例

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


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

示例1: create_new_user

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import email [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: register

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import email [as 别名]
def register(request):
    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():
            person = Person()
            person.name = form.cleaned_data['name']
            person.email = form.cleaned_data['email']
            person.save()
            return HttpResponseRedirect('../list/')
    else:
        form = RegistrationForm()

    return render(request, '../templates/register.html', {'form': form})
开发者ID:armandobatina,项目名称:Python,代码行数:15,代码来源:views.py

示例3: go

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import email [as 别名]
def go(request):
	
	tabselected = None
	filtertag = request.META['PATH_INFO']
	if filtertag.find('/idea/') >= 0:
		filtertag = filtertag[6:]
		tabselected = filtertag.replace('/', '')
#		tabselected = 4
	else:
		filtertag = None
		
 	user = request.user
 	
 	rating = None
 	if user.is_authenticated():
		
		person = views.getPerson(request)
	 	if person:
	 		pratings = Rating.objects().order_by('score')
	 		if pratings and len(pratings)>=0:
	 			for prating in pratings:
	 				if person.currentRating >= prating.score:
	 					rating = prating
	 				else:
						break
	 	else:
			person = Person()
			person.email = user.email
			person.name = str(user)
			person.activationdate = datetime.datetime.now()
			person.save()
			views.incrementStat('users',1)
	 		pratings = Rating.objects().order_by('score')
	 		if pratings and len(pratings)>=0:
	 			for prating in pratings:
	 				if person.currentRating >= prating.score:
	 					rating = prating
					else:
						break
 		
 	
	template_values = {
 		'user':user,
 		'tabselected':tabselected,
 		'filtertag':None,
 		'rating':rating,
	}
	path = os.path.join(os.path.dirname(__file__), 'templates/ideas/index.html')
	return render_to_response(path, template_values)
开发者ID:jamesmwhite,项目名称:innuvate,代码行数:51,代码来源:idea_main.py

示例4: new_person

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import email [as 别名]
def new_person():
    if not g.site.domain == g.user:
        abort(403)

    p = Person()
    if request.method == "POST":
        reqfile = request.files.get('file')
        if reqfile:
            f = File()
            f.site = g.site.domain
            f.name = reqfile.filename
            f.content_type = reqfile.mimetype
            f.slug, f.content_length = save_file(reqfile, current_app.config["UPLOAD_FOLDER"])
            f.save()

        p.site = g.site.domain
        p.name = request.form.get("name")
        p.title = request.form.get("title")
        p.phone = request.form.get("phone")
        p.email = request.form.get("email")
        p.twitter = request.form.get("twitter")
        p.description = request.form.get("description")
        slugs = [ __p.slug for __p in Person.objects.filter(site=g.site.domain) ]
        slug = slugify(p.name)
        counter = 1
        __slug = slug
        while __slug in slugs:
            counter += 1
            __slug = "%s_%d" % (slug, counter)
        p.slug = __slug

        if reqfile:
            p.image_slug = f.slug
        p.save()

        pl = Personnel.objects.get(site=g.site.domain)
        pl.people.append(p.slug)
        pl.save()

        return redirect(url_for(".show_personnel"))
    return render_template("edit_person.html", person=p)
开发者ID:abal09,项目名称:samklang,代码行数:43,代码来源:personnel.py

示例5: load_persons

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import email [as 别名]
def load_persons():
    persons = []
    managers = {}

    # TEAMS
    existing_teams = {}
    teams = Team.query.all()
    for team in teams:
        existing_teams[team.name] = team
    print(existing_teams)

    # ROOMS
    existing_rooms = {}
    rooms = Room.query.all()
    for room in rooms:
        existing_rooms[room.name] = room
    print(existing_rooms)

    # We try to use a custom persons file if it exists. If not, default file
    if (path.isfile(config.DATABASE_PERSONS_FILE)):
        persons_file = config.DATABASE_PERSONS_FILE
    else:
        persons_file = config.DATABASE_PERSONS_DEFAULT_FILE

    with io.open(persons_file, 'r', encoding='utf8') as f:
        for line in f:
            if (len(line) > 1 and line[0] != '#'):
                neo = Person()

                split = line[:-1].split(';')
                neo.login = split[2].strip().lower()
                neo.surname = split[3]
                neo.name = split[4]
                neo.birthday = datetime.datetime.fromtimestamp(float(format_date(split[5])))
                neo.arrival = datetime.datetime.fromtimestamp(float(format_date(split[6])))
                neo.job = split[7]
                neo.email = split[8]
                neo.skype = split[9]
                neo.fixe = split[10]
                neo.mobile = split[11]

                team = split[1]
                manager = split[12]
                room = split[13]

                if manager in managers:
                    managers[manager].append(neo)
                else:
                    managers[manager] = [neo]

                if (team in existing_teams):
                    neo.team = existing_teams[team]

                if (room in existing_rooms):
                    neo.room = existing_rooms[room]

                else:
                    print('Error: Missing team ' + team + ' for ' + neo.login)
                persons.append(neo)

    for person in persons:
        # We link the managers
        if person.login in managers:
            person.subordinates = managers[person.login]
        db.session.add(person)
    db.session.commit()
开发者ID:Mogmi95,项目名称:Trombi,代码行数:68,代码来源:main.py


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