本文整理汇总了Python中model.user.User.email方法的典型用法代码示例。如果您正苦于以下问题:Python User.email方法的具体用法?Python User.email怎么用?Python User.email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.email方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_or_existing_ga
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def new_or_existing_ga(user, alias_suggestion=None):
#id = unicode(type(user).__name__.lower() +':'+ user.user_id())
id = unicode('ah:'+ user.user_id())
entity = User.get_by_key_name(id)
if not entity:
entity = User(key_name=id, email=user.email())
entity.put()
logger.debug("Created user %s (%s)", entity.email, entity.key().name())
#if alias_suggestion and not find_alias(alias_suggestion):
# alias = new_alias(entity, alias_suggestion)
#else:
# alias = new_alias_for(entity)
#assert alias, "FIXME: Cannot create Alias for %s" % user.email()
#alias.put()
#logger.debug("Created alias %s for user (%s).", alias.handle, entity.key().name())
elif entity.email != user.email():
entity.email = user.email()
entity.put()
#alias = new_alias_for(entity)
#if alias:
# logger.debug("Updating user %s for alias %s. ", user.email(), newalias)
# alias.put()
#else:
# logger.info("New alias not available for user %s. ", user.email())
return entity
示例2: create_new_user
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def create_new_user(self, user_keyname, password, set_user=True, **kwargs):
logging.info('creating user with keyname %s' % user_keyname)
user_entity = User(key_name=user_keyname, username=user_keyname)
if password:
user_entity.password = password
if '@passtiche.appspot.com' not in user_keyname and not user_keyname.startswith('auto_gen'):
deferred.defer(send_admin_email, subject='New %s User: %s' % (
self._settings['title'], user_keyname),
message='User %s just signed up for an account' % user_keyname,
user=user_keyname, user_agent=gae_utils.GetUserAgent(), url=gae_utils.GetUrl())
if '@' in user_keyname:
user_entity.email = user_keyname
#send_welcome_email(user_entity.email, 'Welcome to %s!' % self._settings['title'])
deferred.defer(send_welcome_email,
user_entity,
'Welcome to %s!' % self._settings['title'],
_countdown=10) # 1300 22 minutes
# optional args
for k in ['first_name', 'last_name','phone','organization']:
if kwargs.get(k):
v = kwargs.get(k)
setattr(user_entity, k, v)
from utils import string as str_utils
code = str_utils.genkey(length=7)
user_entity.short_code = code
user_entity.put()
if set_user:
self.set_current_user(user_entity)
return user_entity
示例3: get
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def get(self):
user = User()
user.email = ""
user.password = ""
user.name=""
user.password_confirm = ""
return self.render('setting_add_user.html', user_name="", user=user, errors={})
示例4: test_validate_fails
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def test_validate_fails(self):
user = User(self.complete_data)
user.email = 'fake'
user.private_token = 'fake'
user.auth_token = 'fake'
user.salt = 'fake'
with assert_raises(ModelValidationError) as cm:
user.validate()
ok_('email' in cm.exception.messages.keys())
ok_('private_token' in cm.exception.messages.keys())
ok_('auth_token' in cm.exception.messages.keys())
ok_('salt' in cm.exception.messages.keys())
示例5: get_events
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def get_events(self, params):
"""
Gets events from calendar
"""
calendar_service = gdata.calendar.service.CalendarService()
# Tell the service that we are running in single user mode, and it should not
# automatically try to associate the token with the current user then store
# it in the datastore.
gdata.alt.appengine.run_on_appengine(calendar_service, store_tokens=False, single_user_mode=True)
calendar_service.SetClientLoginToken(db.get(db.Key(params.key)).token)
# Parse Atom entries into CalendarEvent value objects
events = ArrayCollection()
feed = calendar_service.GetCalendarEventFeed()
for i, an_event in enumerate(feed.entry):
event = CalendarEvent()
event.title = an_event.title.text
# Convert start/end ISO time values to datetime using a different
# format depending on whether the string contains time information
start = an_event.when[0].start_time
end = an_event.when[0].end_time
if len(start) > 10:
event.start = datetime.strptime(start[0:19], DATETIME_ISO_STRING_FORMAT)
event.end = datetime.strptime(end[0:19], DATETIME_ISO_STRING_FORMAT)
else:
event.start = datetime.strptime(start, DATE_ISO_STRING_FORMAT)
event.end = datetime.strptime(end, DATE_ISO_STRING_FORMAT)
event.location = an_event.where[0].value_string
event.description = an_event.content.text
event.updated = datetime.strptime(an_event.updated.text[0:19], DATETIME_ISO_STRING_FORMAT)
# Create array collection of participants as User value objects
participants = ArrayCollection()
for p, a_participant in enumerate(an_event.who):
participant = User()
participant.name = a_participant.name
participant.email = a_participant.email
if a_participant.attendee_status:
participant.attendeeStatus = a_participant.attendee_status.value
participants.addItem(participant)
event.participants = participants
events.addItem(event)
return events
示例6: post
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import email [as 别名]
def post(self):
email = self.get_argument('email','')
user_name = self.get_argument('user_name','')
password = self.get_argument('password','')
password_confirm = self.get_argument('password_confirm','')
user = User()
user.email = email
user.name = user_name
user.password = password
user.password_confirm = password_confirm
user_id = user.create()
if not user_id:
return self.render('register.html', user_name="", user=user, errors=user.errors)
#return self.send_error_json(user.errors)
else:
self.redirect('/login')