本文整理汇总了Python中user.User.set方法的典型用法代码示例。如果您正苦于以下问题:Python User.set方法的具体用法?Python User.set怎么用?Python User.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_user
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set [as 别名]
def create_user(uid):
user = User()
user.set('uid', uid)
if not create_user_dir(user):
return None
add_user(user)
return user
示例2: User
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set [as 别名]
from user import User
from member import Member
from section import Section
from page import Page
from datetime import datetime
from time import localtime
sections = Section.find()
"""
for section in sections:
section.attr['create_time'] = datetime.fromtimestamp(section.attr['create_time'])
section.attr['modified_time'] = datetime.fromtimestamp(section.attr['modified_time'])
section.commit()
"""
"""
pages = Page.find()
for page in pages:
page.attr['create_time'] = datetime.fromtimestamp(page.attr['create_time'])
page.attr['modified_time'] = datetime.fromtimestamp(page.attr['modified_time'])
page.commit()
"""
a = User()
print (a.attr)
a.set({'email': "[email protected]", "username": "tanghaomo"})
print (a.attr)
示例3: str
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set [as 别名]
if config.get('download-header') != None:
downloadHeaders = str(config.get('download-header'))
downloadHeaderList = downloadHeaders.split('|')
if config.get('output-dir') != None:
outputDir = config.get('output-dir')
try:
decodePassword = base64.decodestring(password)
except:
encrypt_user_password(config)
decodePassword = password
user = User()
user.set('userName', userName)
user.set('password', decodePassword)
if len(downloadHeaderList) == 0:
report_error_arg_value('download-header')
exit(0)
config.saveToFile(configFile)
outputDir += '/' + str(pbsNumber)
if os.path.isdir(outputDir) == False:
os.mkdir(outputDir)
print(downloadHeaderList)
getter = PbsProductGetter(pbsNumber,
user,
示例4: get_header
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set [as 别名]
from user import User
from helpers import send_to_queue
import email.utils, oauth2client, datetime
def get_header(message, name):
for header in message['payload']['headers']:
if header['name'] == name:
return header['value']
return None
while True:
for u in users.find({'disabled': True}):
user = User(u['email'])
expiry_date = datetime.datetime.utcnow() - datetime.timedelta(hours=1)
if user.get('disabled_at', expiry_date) <= expiry_date:
user.set('disabled', False)
for u in users.find({'disabled': {'$ne': True}}):
user = User(u['email'])
try:
messages, history_token = user.get_new_messages()
except oauth2client.client.AccessTokenRefreshError:
print "Disabled User {}".format(user.get('_id'))
user.update({'disabled': True, 'disabled_at': datetime.datetime.utcnow()})
continue
user.set('history_token', history_token)
for message in messages:
if 'TRASH' in message.get('labelIds', []):
continue
if processed_data.find_one({'email_id': message['id']}):
continue
if message['payload']['mimeType'] in ['text/plain', 'text/html']: