本文整理汇总了Python中models.user.User.role方法的典型用法代码示例。如果您正苦于以下问题:Python User.role方法的具体用法?Python User.role怎么用?Python User.role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.role方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_to_user
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import role [as 别名]
def convert_to_user(user_id, data_map):
user = User(user_id)
user.name = data_map['name']
user.role = data_map['role']
user.manager = data_map['manager']
user.state = data_map['state']
user.team = data_map['team']
user.step = data_map['step']
user.email = data_map['email']
user.start_date = data_map['start_date']
return user
示例2: main
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import role [as 别名]
def main(argv=sys.argv):
if len(argv) < 2:
usage(argv)
config_uri = argv[1]
options = parse_vars(argv[2:])
setup_logging(config_uri)
settings = get_appsettings(config_uri, options=options)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
DBSession.add(Item(
"Nutrigrain Raspberry",
"038000358210",
14.37,
0.47,
False,
False,
3,
True
))
DBSession.add(Item(
"Clif Bar: Chocolate Chip",
"722252100900",
1.25,
1.17,
False,
False,
12,
True
))
DBSession.add(Item(
"Clif Bar: Crunchy Peanut Butter",
"722252101204",
1.25,
1.14,
False,
False,
11,
True
))
coke = Item(
"Coke (12 oz)",
"04963406",
0.42,
0.37,
True,
False,
8,
True
)
DBSession.add(coke)
# user = User(
# "zakir",
# "95951361",
# "Zakir Durumeric"
# )
# user.role = "administrator"
# user.password = "test"
# DBSession.add(user)
user = User(
"bradjc",
"11519022",
"Brad Campbell"
)
user.role = "administrator"
user.password = "test"
DBSession.add(user)
user = User(
"ppannuto",
"64880621",
"Pat Pannuto"
)
user.role = "administrator"
user.password = "test2"
DBSession.add(user)
user = User(
"betty",
"00000000",
"Betty"
)
user.role = "serviceaccount"
user.password = "cb"
DBSession.add(user)
account.get_virt_account("chezbetty")
account.get_cash_account("cashbox")
account.get_cash_account("chezbetty")
account.get_cash_account("btcbox")
coke_box = Box(
"Coke 32 pack", # name
"049000042511", # barcode
True, # bottle deposit
False, # sales tax
32.00, # wholesale
# enabled implicit True
)
DBSession.add(coke_box)
DBSession.flush()
DBSession.add(BoxItem(coke_box, coke, 32, 100))
示例3: main
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import role [as 别名]
def main(argv=sys.argv):
if len(argv) < 2:
usage(argv)
config_uri = argv[1]
options = parse_vars(argv[2:])
setup_logging(config_uri)
settings = get_appsettings(config_uri, options=options)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
DBSession.add(Item(
"Nutrigrain Raspberry",
"038000358210",
14.37,
0.47,
1,
True
))
DBSession.add(Item(
"Clif Bar: Chocolate Chip",
"722252100900",
1.25,
1.17,
5,
True
))
DBSession.add(Item(
"Clif Bar: Crunchy Peanut Butter",
"722252101204",
1.25,
1.14,
5,
True
))
DBSession.add(Item(
"Coke (12 oz)",
"04963406",
0.42,
0.37,
12,
True
))
# user = User(
# "zakir",
# "95951361",
# "Zakir Durumeric"
# )
# user.role = "administrator"
# user.password = "test"
# DBSession.add(user)
user = User(
"bradjc",
"11519022",
"Brad Campbell"
)
user.role = "administrator"
user.password = "test"
DBSession.add(user)
user = User(
"ppannuto",
"64880621",
"Pat Pannuto"
)
user.role = "administrator"
user.password = "test2"
DBSession.add(user)
user = User(
"betty",
"00000000",
"Betty"
)
user.role = "serviceaccount"
user.password = "cb"
DBSession.add(user)
account.get_virt_account("chezbetty")
account.get_cash_account("cashbox")
account.get_cash_account("chezbetty")
account.get_cash_account("btcbox")
示例4: main
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import role [as 别名]
def main(argv=sys.argv):
if len(argv) < 2:
usage(argv)
config_uri = argv[1]
options = parse_vars(argv[2:])
setup_logging(config_uri)
settings = get_appsettings(config_uri, options=options)
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
with transaction.manager:
# Setup a few initial items
DBSession.add(Item(
"Nutrigrain Raspberry",
"038000358210",
14.37,
0.47,
False,
False,
3,
True
))
DBSession.add(Item(
"Clif Bar: Chocolate Chip",
"722252100900",
1.25,
1.17,
False,
False,
12,
True
))
DBSession.add(Item(
"Clif Bar: Crunchy Peanut Butter",
"722252101204",
1.25,
1.14,
False,
False,
11,
True
))
coke = Item(
"Coke (12 oz)",
"04963406",
0.42,
0.37,
True,
False,
8,
True
)
DBSession.add(coke)
# Add a test box
coke_box = Box(
"Coke 32 pack", # name
"049000042511", # barcode
True, # bottle deposit
False, # sales tax
32.00, # wholesale
# enabled implicit True
)
DBSession.add(coke_box)
DBSession.flush()
DBSession.add(BoxItem(coke_box, coke, 32, 100))
# Add the betty user
DBSession.add(coke)
user = User(
"betty",
"00000000",
"Betty"
)
user.role = "serviceaccount"
user.password = "chezbetty"
DBSession.add(user)
# Add an admin user
user = User(
"admin",
"56785678",
"Administrator"
)
user.role = "administrator"
user.password = "chezbettyadmin"
DBSession.add(user)
# Init the accounts we need
account.get_virt_account("chezbetty")
account.get_cash_account("cashbox")
account.get_cash_account("safe")
account.get_cash_account("chezbetty")
account.get_cash_account("btcbox")