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


Python User.set方法代码示例

本文整理汇总了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
开发者ID:proximate,项目名称:proximate,代码行数:9,代码来源:proximatestate.py

示例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)
开发者ID:Alston-Tang,项目名称:REIC,代码行数:30,代码来源:test.py

示例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,
开发者ID:raidenawkward,项目名称:django,代码行数:32,代码来源:pget.py

示例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']:
开发者ID:ProjectClarity,项目名称:importer,代码行数:33,代码来源:monitor.py


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