本文整理汇总了Python中account.Account.save方法的典型用法代码示例。如果您正苦于以下问题:Python Account.save方法的具体用法?Python Account.save怎么用?Python Account.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account.Account
的用法示例。
在下文中一共展示了Account.save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDeleteAccount
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import save [as 别名]
def testDeleteAccount(self):
acc = Account(user="user", passwd="passwd", email="email")
acc.save()
acc = Account.fetch(user="user")
assert acc.user == "user"
acc.delete()
acc = Account.fetch(user="user")
assert acc is None
示例2: _load_account_data
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import save [as 别名]
def _load_account_data(self, filename):
with open(filename, "r") as myf:
fcsv = csv.reader(myf)
header = fcsv.next()
for line in fcsv:
if line[0] == self.meter_id:
try:
a = Account.objects.get(meter=self)
except:
a = Account(meter=self)
a.pidm = line[1]
a.cust_code = line[2]
a.last_name = line[3]
a.last_name_sdx = line[4]
a.status_ind = line[5]
a.start_date = line[6]
a.activity_date = line[7]
a.user_id = line[8]
a.ten99_ind = line[9]
a.first_name = line[10]
a.first_name_sdx = line[11]
a.middle_name = line[12]
a.middle_name_sdx = line[13]
a.ssn = line[14]
a.drivers_license = line[15]
a.ethn_code = line[16]
a.credit_rating = line[17]
a.employer = line[18]
a.pay_by_check_ind = line[19]
a.spouses_name = line[20]
a.end_date = line[21]
a.bmsg_code = line[22]
a.ten99_id = line[23]
a.ten99_wh_pct = line[24]
a.ten99_state = line[25]
a.natn_code_d_l = line[26]
a.stat_code_d_l = line[27]
a.spouses_ssn = line[28]
a.ten99_primary_ind = line[29]
a.title = line[30]
a.mmbr_type_ind = line[31]
a.last_name_upr = line[32]
a.approval_code = line[33]
a.lrg_prnt_ind = line[34]
a.lang_code = line[35]
a.letr_ind = line[36]
a.birth_date = line[37]
a.save()
return True
return False
示例3: testCreateAccount
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import save [as 别名]
def testCreateAccount(self):
self.assertRaises(TypeError, Account, user="user")
self.assertRaises(TypeError, Account, passwd="passwd")
acc = Account(user="user", passwd="passwd", email="email")
acc.save()
print "Acc made:", acc
acc = Account.fetch(user="foo")
assert acc is None
acc = Account.fetch(user="user")
assert acc.user == "user"
acc = Account.fetch(email="bar")
assert acc is None
acc = Account.fetch(email="email")
assert acc.email == "email"
示例4: testFetchAccount
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import save [as 别名]
def testFetchAccount(self):
# Hey, this test is redundant(!) with the previous, but I can't
# decide what to test where, is this coupeled enough to
# merge?
acc = Account(user="user", passwd="passwd", email="email")
acc.save()
acc = Account.fetch(user="foo")
assert acc is None
acc = Account.fetch(user="user")
assert acc.user == "user"
acc = Account.fetch(email="bar")
assert acc is None
acc = Account.fetch(email="email")
assert acc.email == "email"
示例5: testModifyAccount
# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import save [as 别名]
def testModifyAccount(self):
# You'r allowed to change passwd & e-mail
# But not your username!
acc = Account(user="user", passwd="passwd", email="email")
acc.save()
acc = Account.fetch(user="user")
assert acc.user == "user"
acc.user = "newname"
self.assertRaises(TypeError, acc.save)
acc = Account.fetch(user="user")
assert acc.user == "user"
assert acc.passwd == "passwd"
assert acc.email == "email"
acc.passwd = "newpass"
acc.email = "newmail"
acc.save()
acc = None
acc = Account.fetch(user="user")
assert acc.user == "user"
assert acc.passwd == "newpass"
assert acc.email == "newmail"