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


Python User.create方法代码示例

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


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

示例1: create

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def create(self, id):
     d = []
     u = User(d[2])
     u.create(conf.group, d[3])
     self.rpc_srv.set_account_uidguid(
         self.token, u.username, u.uid, u.gid)
     status = 0
     result = "%s %s %s" % (u.username, u.uid, u.gid)
开发者ID:Pajinek,项目名称:vhm,代码行数:10,代码来源:vhmserver.py

示例2: init_db

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def init_db():
    if not SyncLog.table_exists():
        SyncLog.create_table()
    if not User.table_exists():
        User.create_table()
        User.create(username='admin',
                    password=make_password('admin'),
                    admin=True)
    for mod_class in MASTER_CLASSES.keys():
        if not MODELS_CLASS[mod_class].table_exists():
            MODELS_CLASS[mod_class].create_table()
    for mod_class in sorted(DEPENDENT_CLASSES.keys()):
        if not MODELS_CLASS[mod_class].table_exists():
            MODELS_CLASS[mod_class].create_table()
开发者ID:Comunitea,项目名称:CMNT_004_15,代码行数:16,代码来源:admin.py

示例3: login_signup_callback_view

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def login_signup_callback_view():
  error = request.args.get('error')
  code = request.args.get('code')
  if not code:
    return error or 'error'
  credentials = get_flow().step2_exchange(code)
  credentials_object = json.loads(credentials.to_json())
  user_info = User.fetch_info(credentials)
  u = User(user_info['email'])
  if not u.check():
    u.create(credentials=credentials_object, **user_info)
  if u.get('disabled', False):
    u.update({'disabled': False, 'credentials': credentials_object})
  login_user(u, remember=True)
  return redirect(url_for('index_view'))
开发者ID:ProjectClarity,项目名称:web,代码行数:17,代码来源:routes.py

示例4: test_user_update

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def test_user_update(self):
     old_username = 'Taro'
     old_password = 'password'
     old_role = 'user'
     user = User.create(
         old_username,
         old_password,
         old_role
     )
     ok_(user.password_auth(old_password))
     eq_(user.role, Role.user)
     new_username = 'Jiro'
     new_password = 'new_password'
     new_role = 'admin'
     user.update(
         new_username,
         new_password,
         new_role
     )
     ok_(not user.password_auth(old_password))
     ok_(user.password_auth(new_password))
     eq_(user.role, Role.admin)
     user.update(
         role=old_role
     )
     ok_(user.password_auth(new_password))
     eq_(user.role, Role.user)
开发者ID:nasa9084,项目名称:api-charakoba.com,代码行数:29,代码来源:test_user.py

示例5: test_remove_user_from_group

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def test_remove_user_from_group(self):
     user = User.create(self.client, self.ad_user.s_am_account_name)
     user.activate()
     user.add_to_group(2819)
     user.remove_from_group(2819)
     """TODO: Assert user NOT in group"""
     user.delete()
开发者ID:litedesk,项目名称:litedesk-lib-airwatch,代码行数:9,代码来源:test.py

示例6: post

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
	def post(self):
		data = json.loads(self.request.body)
		key = User.create(data['email'], data['password'])
		if key == False:
			self.response.write('{"success":false,"reason":"Sorry, this email already exists did you mean to log in?"}')
		else:
			self.session['user'] = data['email']
			self.response.write('{"success":true}')
开发者ID:RobJohnstone,项目名称:timeTracker,代码行数:10,代码来源:signup.py

示例7: index

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def index():
    info=None
    if request.method =='POST':
        name=request.form['name']
        email=request.form['email']
        passwrd=request.form['pswd']
        if not name or not email or not passwrd:
            info="Fields cannot Be Blank"
        else:
            u=User()
            info=u.create(name,email,passwrd)
    return render_template('index.html',info=info)
开发者ID:Optimus-Nishant,项目名称:storeapi,代码行数:14,代码来源:main.py

示例8: signup

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def signup(jsonData):
    username, password = authenticate._get_user_and_pass_from_json(jsonData)

    if User.fromName(username) is not None:
        raise apiexceptions.UserAlreadyExists()

    user = User.create()
    user.name = username
    user.set_password(password)
    user.commit()

    session['uid'] = user.name

    return ValidResponse(user=user.to_json())
开发者ID:rpindulic,项目名称:Quaggy,代码行数:16,代码来源:app.py

示例9: create_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def create_user():
    if request.data:
        try:
            payload = json.loads(request.data)
            email = payload["email"]
            username = payload["username"]
            password = payload["password"]
            existing_user = User.query.filter_by(email=email).first()
            if existing_user is None:
                new_user = User(email, username, password)
                new_user.create()
                status_text = "User succesfully added"
                response = jsonify(statusText=status_text)
                response.status_code = 200
                return response
            else:
                status_text = "User already exists"
                response = jsonify(statusText=status_text)
                response.status_code = 400
                return response
        except KeyError:
            pass
    return QuickJson.invalid_json()
开发者ID:Gourave,项目名称:Vitesse_API,代码行数:25,代码来源:api.py

示例10: add_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def add_user(self):
     username = self.new_user_name.text()
     password = self.new_password.text()
     if User.create(username, password):
         self._message_box("User Added", "User {} added".format(username))
开发者ID:28Althea,项目名称:op-introduction-to-security,代码行数:7,代码来源:passwords.py

示例11: get_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
def get_user():
    user_id = request.cookies.get('u')
    user = User.load(user_id)
    if not user:
        user = User.create()
    return user
开发者ID:boivie,项目名称:uplinq-geosnap,代码行数:8,代码来源:run.py

示例12: int

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
logging.info('取得したIDをループでまわす')
for list in target_follow_lists:
    res.user_information(list)
    logging.info(res.name)
    logging.info("screen_name: %s" % res.screen_name)
    if res.user_id in user_ids:
        logging.info("同じものです")
        continue    
    college = command.college_decision(res.description)
    if college == None:
        logging.info("大学生じゃない")
        continue
    if command.black_list_decision(res.name):
        logging.info("ブラックリストです")
        continue
    if res.follow_count > 1000:
        logging.info("フォローが多い")
        continue
    # one_week_second = 604800
    # today = int(datetime.now().strftime('%s'))
    # last_tweet_time = int(dateutil.parser.parse(status["created_at"]).strftime('%s'))
    # if (today - last_tweet_time) > one_week_second:
    #     continue
    logging.info('データを登録するよ %s' % res.name)
    try:
        user_model.create(name = res.name, user_id = res.user_id, screen_name = res.screen_name, follow_count = res.follow_count, follower_count = res.follower_count, follow_flg = res.follow_flg, follower_flg = res.follower_flg, url = res.url, college = college, description = res.description, protected = res.protected)
        logging.info("データ登録完了 %s" % res.name)
    except:
        traceback.print_exc()
        continue
开发者ID:MotohiroSiobara,项目名称:bar_event_bot,代码行数:32,代码来源:girl_save.py

示例13: raw_input

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
                print "deleting %s with password %s" % (user.email, user.password)
                
                user.delete()
                user = None

        elif command == "create":
            email = raw_input("Email: ")
            password = getpass.getpass("Password: ")
            password_confirm = getpass.getpass("Confirm Password: ")
            while password != password_confirm:
                print "Passwords do no match"
                password = getpass.getpass("Password: ")
                password_confirm = getpass.getpass("Confirm Password: ")

            user = User(email, password, '', host)
            user.create(bcrypt.hashpw(password, bcrypt.gensalt(10)))

        elif command == "users":
            if not user.email == 'admin':
                print "Must have admin privileges"
                continue

            print admin.list_users(user.password, host)

        elif command == "change":
            if not user.email == 'admin':
                print "Must have admin privileges"
                continue

            old_email = raw_input("Email: ")
            new_email = raw_input("New Email: ")
开发者ID:wbthomason,项目名称:cs3240-onedir,代码行数:33,代码来源:one_dir_client.py

示例14: test_deactivate_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def test_deactivate_user(self):
     user = User.create(self.client, self.ad_user.s_am_account_name)
     user.activate()
     user.deactivate()
     self.assertEqual(User.get_remote(self.client, self.ad_user.s_am_account_name).Status, False)
     user.delete()
开发者ID:litedesk,项目名称:litedesk-lib-airwatch,代码行数:8,代码来源:test.py

示例15: test_delete_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import create [as 别名]
 def test_delete_user(self):
     user = User.create(self.client, self.ad_user.s_am_account_name)
     user.delete()
     self.assertIsNone(User.get_remote(self.client, self.ad_user.s_am_account_name))
开发者ID:litedesk,项目名称:litedesk-lib-airwatch,代码行数:6,代码来源:test.py


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