本文整理汇总了Python中webnotes.utils.random_string函数的典型用法代码示例。如果您正苦于以下问题:Python random_string函数的具体用法?Python random_string怎么用?Python random_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random_string函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run_accounts
def run_accounts(current_date):
if can_make("Sales Invoice"):
from selling.doctype.sales_order.sales_order import make_sales_invoice
report = "Ordered Items to be Billed"
for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Sales Invoice")]:
si = webnotes.bean(make_sales_invoice(so))
si.doc.posting_date = current_date
for d in si.doclist.get({"parentfield": "entries"}):
if not d.income_account:
d.income_account = "Sales - {}".format(company_abbr)
si.insert()
si.submit()
webnotes.conn.commit()
if can_make("Purchase Invoice"):
from stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
report = "Received Items to be Billed"
for pr in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Purchase Invoice")]:
pi = webnotes.bean(make_purchase_invoice(pr))
pi.doc.posting_date = current_date
pi.doc.bill_no = random_string(6)
pi.insert()
pi.submit()
webnotes.conn.commit()
if can_make("Payment Received"):
from accounts.doctype.journal_voucher.journal_voucher import get_payment_entry_from_sales_invoice
report = "Accounts Receivable"
for si in list(set([r[4] for r in query_report.run(report, {"report_date": current_date })["result"] if r[3]=="Sales Invoice"]))[:how_many("Payment Received")]:
jv = webnotes.bean(get_payment_entry_from_sales_invoice(si))
jv.doc.posting_date = current_date
jv.doc.cheque_no = random_string(6)
jv.doc.cheque_date = current_date
jv.insert()
jv.submit()
webnotes.conn.commit()
if can_make("Payment Made"):
from accounts.doctype.journal_voucher.journal_voucher import get_payment_entry_from_purchase_invoice
report = "Accounts Payable"
for pi in list(set([r[4] for r in query_report.run(report, {"report_date": current_date })["result"] if r[3]=="Purchase Invoice"]))[:how_many("Payment Made")]:
jv = webnotes.bean(get_payment_entry_from_purchase_invoice(pi))
jv.doc.posting_date = current_date
jv.doc.cheque_no = random_string(6)
jv.doc.cheque_date = current_date
jv.insert()
jv.submit()
webnotes.conn.commit()
开发者ID:abordin,项目名称:erpnext,代码行数:49,代码来源:make_demo.py
示例2: send_welcome_mail
def send_welcome_mail(self):
"""send welcome mail to user with password and login url"""
from webnotes.utils import random_string, get_url
self.doc.reset_password_key = random_string(32)
link = get_url("/update-password?key=" + self.doc.reset_password_key)
txt = """
%(company)s
Dear %(first_name)s,
A new account has been created for you.
Your login id is: %(user)s
To complete your registration, please click on the link below:
<a href="%(link)s">%(link)s</a>
Thank you,<br>
%(user_fullname)s
"""
self.send_login_mail("Welcome to MedSynaptic" , txt,
{ "link": link })
开发者ID:saurabh6790,项目名称:alert-med-lib,代码行数:26,代码来源:profile.py
示例3: send_welcome_mail
def send_welcome_mail(self):
from webnotes.utils import random_string, get_url
self.doc.reset_password_key = random_string(32)
link = get_url("/update-password?key=" + self.doc.reset_password_key)
self.send_login_mail("Verify Your Account", "templates/emails/new_user.html", {"link": link})
开发者ID:bindscha,项目名称:wnframework_old,代码行数:7,代码来源:profile.py
示例4: sign_up
def sign_up(email, full_name):
profile = webnotes.conn.get("Profile", {"email": email})
if profile:
if profile.disabled:
return _("Registered but disabled.")
else:
return _("Already Registered")
else:
if (
webnotes.conn.sql(
"""select count(*) from tabProfile where
TIMEDIFF(%s, modified) > '1:00:00' """,
now(),
)[0][0]
> 200
):
raise Exception, "Too Many New Profiles"
from webnotes.utils import random_string
profile = webnotes.bean(
{
"doctype": "Profile",
"email": email,
"first_name": full_name,
"enabled": 1,
"new_password": random_string(10),
"user_type": "Website User",
}
)
profile.ignore_permissions = True
profile.insert()
return _("Registration Details Emailed.")
开发者ID:saurabh6790,项目名称:med_lib_rels,代码行数:32,代码来源:profile.py
示例5: reset_password
def reset_password(self):
"""reset password"""
from webnotes.utils import random_string, now
pwd = random_string(8)
# update tab Profile
webnotes.conn.sql("""UPDATE tabProfile SET password=password(%s), modified=%s
WHERE name=%s""", (pwd, now(), self.name))
return pwd
开发者ID:aarohan,项目名称:wnframework,代码行数:10,代码来源:profile.py
示例6: get_conf_params
def get_conf_params(db_name=None, db_password=None):
if not db_name:
db_name = raw_input("Database Name: ")
if not db_name:
raise Exception("Database Name Required")
if not db_password:
from webnotes.utils import random_string
db_password = random_string(16)
return {"db_name": db_name, "db_password": db_password}
开发者ID:ricardomomm,项目名称:wnframework,代码行数:11,代码来源:install.py
示例7: reset_password
def reset_password():
from webnotes.model.code import get_obj
from webnotes.utils import random_string
user = webnotes.form_dict.get('user', '')
if user in ["[email protected]", "Administrator"]:
webnotes.msgprint("Not allowed", raise_exception=1)
if webnotes.conn.sql("""select name from tabProfile where name=%s""", user):
new_password = random_string(8)
webnotes.conn.sql("""update `__Auth` set password=password(%s)
where `user`=%s""", (new_password, user))
# Hack!
webnotes.session["user"] = "Administrator"
profile = get_obj("Profile", user)
profile.password_reset_mail(new_password)
webnotes.msgprint("Password has been reset and sent to your email id.")
else:
webnotes.msgprint("No such user (%s)" % user)
开发者ID:IPenuelas,项目名称:wnframework,代码行数:20,代码来源:handler.py
示例8: reset_password
def reset_password(self):
from webnotes.utils import random_string, get_url
key = random_string(32)
webnotes.conn.set_value("Profile", self.doc.name, "reset_password_key", key)
self.password_reset_mail(get_url("/update-password?key=" + key))
开发者ID:saurabh6790,项目名称:alert-med-lib,代码行数:6,代码来源:profile.py
注:本文中的webnotes.utils.random_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论