• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.get_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.utils.get_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_url函数的具体用法?Python get_url怎么用?Python get_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: send_email

	def send_email(self):
		"""
			Sends the link to backup file located at erpnext/backups
		"""
		from webnotes.utils.email_lib import sendmail, get_system_managers

		recipient_list = get_system_managers()
		db_backup_url = get_url(os.path.join('backups', os.path.basename(self.backup_path_db)))
		files_backup_url = get_url(os.path.join('backups', os.path.basename(self.backup_path_files)))
		
		msg = """<p>Hello,</p>
		<p>Your backups are ready to be downloaded.</p>
		<p>1. <a href="%(db_backup_url)s">Click here to download\
		 the database backup</a></p>
		<p>2. <a href="%(files_backup_url)s">Click here to download\
		the files backup</a></p>
		<p>This link will be valid for 24 hours. A new backup will be available 
		for download only after 24 hours.</p>
		<p>Have a nice day!<br>ERPNext</p>""" % {
			"db_backup_url": db_backup_url,
			"files_backup_url": files_backup_url
		}
		
		datetime_str = datetime.fromtimestamp(os.stat(self.backup_path_db).st_ctime)
		subject = datetime_str.strftime("%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""
		
		sendmail(recipients=recipient_list, msg=msg, subject=subject)
		return recipient_list
开发者ID:bindscha,项目名称:wnframework_old,代码行数:28,代码来源:backups.py


示例2: notify_errors

def notify_errors(inv, owner):
	import webnotes
	import website
		
	exception_msg = """
		Dear User,

		An error occured while creating recurring invoice from %s (at %s).

		May be there are some invalid email ids mentioned in the invoice.

		To stop sending repetitive error notifications from the system, we have unchecked
		"Convert into Recurring" field in the invoice %s.


		Please correct the invoice and make the invoice recurring again. 

		<b>It is necessary to take this action today itself for the above mentioned recurring invoice \
		to be generated. If delayed, you will have to manually change the "Repeat on Day of Month" field \
		of this invoice for generating the recurring invoice.</b>

		Regards,
		Administrator
		
	""" % (inv, get_url(), inv)
	subj = "[Urgent] Error while creating recurring invoice from %s" % inv

	from webnotes.profile import get_system_managers
	recipients = get_system_managers()
	owner_email = webnotes.conn.get_value("Profile", owner, "email")
	if not owner_email in recipients:
		recipients.append(owner_email)

	assign_task_to_owner(inv, exception_msg, recipients)
	sendmail(recipients, subject=subj, msg = exception_msg)
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:35,代码来源:sales_invoice.py


示例3: send_login_mail

	def send_login_mail(self, subject, txt, add_args):
		"""send mail with login details"""
		import os
	
		from webnotes.utils.email_lib import sendmail_md
		from webnotes.profile import get_user_fullname
		from webnotes.utils import get_url
		
		full_name = get_user_fullname(webnotes.session['user'])
		if full_name == "Guest":
			full_name = "Administrator"
	
		args = {
			'first_name': self.doc.first_name or self.doc.last_name or "user",
			'user': self.doc.name,
			'company': webnotes.conn.get_default('company') or webnotes.get_config().get("app_name"),
			'login_url': get_url(),
			'product': webnotes.get_config().get("app_name"),
			'user_fullname': full_name
		}
		
		args.update(add_args)
		
		sender = webnotes.session.user not in ("Administrator", "Guest") and webnotes.session.user or None
		
		if self.doc.email:
			sendmail_md(recipients=self.doc.email, sender=sender, subject=subject, msg=txt % args)
		elif self.doc.number:
			# webnotes.errprint(self.doc.number)
			# msgprint(get_obj('SMS Control', 'SMS Control').send_sms(self.doc.number, txt % args))
			msg = txt % args
			self.send_sms(msg)
开发者ID:saurabh6790,项目名称:alert-med-lib,代码行数:32,代码来源:profile.py


示例4: 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


示例5: send_login_mail

	def send_login_mail(self, subject, template, add_args):
		"""send mail with login details"""
		from webnotes.profile import get_user_fullname
		from webnotes.utils import get_url
		
		mail_titles = webnotes.get_hooks().get("login_mail_title", [])
		title = webnotes.conn.get_default('company') or (mail_titles and mail_titles[0]) or ""
		
		full_name = get_user_fullname(webnotes.session['user'])
		if full_name == "Guest":
			full_name = "Administrator"
	
		args = {
			'first_name': self.doc.first_name or self.doc.last_name or "user",
			'user': self.doc.name,
			'title': title,
			'login_url': get_url(),
			'user_fullname': full_name
		}
		
		args.update(add_args)
		
		sender = webnotes.session.user not in ("Administrator", "Guest") and webnotes.session.user or None
		
		webnotes.sendmail(recipients=self.doc.email, sender=sender, subject=subject, 
			message=webnotes.get_template(template).render(args))
开发者ID:bindscha,项目名称:wnframework_old,代码行数:26,代码来源:profile.py


示例6: 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


示例7: send_login_mail

    def send_login_mail(self, subject, txt, add_args):
        """send mail with login details"""
        import os

        from webnotes.utils.email_lib import sendmail_md
        from webnotes.profile import get_user_fullname
        from webnotes.utils import get_url

        full_name = get_user_fullname(webnotes.session["user"])
        if full_name == "Guest":
            full_name = "Administrator"

        args = {
            "first_name": self.doc.first_name or self.doc.last_name or "user",
            "user": self.doc.name,
            "company": webnotes.conn.get_default("company") or webnotes.get_config().get("app_name"),
            "login_url": get_url(),
            "product": webnotes.get_config().get("app_name"),
            "user_fullname": full_name,
        }

        args.update(add_args)

        sender = webnotes.session.user not in ("Administrator", "Guest") and webnotes.session.user or None

        sendmail_md(recipients=self.doc.email, sender=sender, subject=subject, msg=txt % args)
开发者ID:saurabh6790,项目名称:med_lib_rels,代码行数:26,代码来源:profile.py


示例8: set_portal_link

def set_portal_link(sent_via, comm):
	"""set portal link in footer"""
	from webnotes.webutils import is_portal_enabled, get_portal_links
	from webnotes.utils import get_url, cstr
	import urllib

	footer = None

	if is_portal_enabled():
		portal_opts = get_portal_links().get(sent_via.doc.doctype)
		if portal_opts:
			valid_recipient = cstr(sent_via.doc.email or sent_via.doc.email_id or
				sent_via.doc.contact_email) in comm.recipients
			
			if not valid_recipient:
				attach_portal_link = False
			else:
				attach_portal_link = True
				if portal_opts.get("conditions"):
					for fieldname, val in portal_opts["conditions"].items():
						if sent_via.doc.fields.get(fieldname) != val:
							attach_portal_link = False
							break

			if attach_portal_link:
				url = "%s/%s?name=%s" % (get_url(), portal_opts["page"],
					urllib.quote(sent_via.doc.name))
				footer = """<!-- Portal Link --><hr>
						<a href="%s" target="_blank">View this on our website</a>""" % url
			
	return footer
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:31,代码来源:communication.py


示例9: notify

def notify(arg=None):
	from webnotes.utils import cstr, get_fullname, get_url
	
	webnotes.sendmail(\
		recipients=[webnotes.conn.get_value("Profile", arg["contact"], "email") or arg["contact"]],
		sender= webnotes.conn.get_value("Profile", webnotes.session.user, "email"),
		subject="New Message from " + get_fullname(webnotes.user.name),
		message=webnotes.get_template("templates/emails/new_message.html").render({
			"from": get_fullname(webnotes.user.name),
			"message": arg['txt'],
			"link": get_url()
		})
	)	
开发者ID:bindscha,项目名称:wnframework_old,代码行数:13,代码来源:messages.py


示例10: report_errors

def report_errors():
	from webnotes.utils.email_lib import sendmail_to_system_managers
	from webnotes.utils import get_url
	
	errors = [("""<p>Time: %(modified)s</p>
<pre><code>%(error)s</code></pre>""" % d) for d in webnotes.conn.sql("""select modified, error 
		from `tabScheduler Log` where DATEDIFF(NOW(), modified) < 1 
		and error not like '%%[Errno 110] Connection timed out%%' 
		limit 10""", as_dict=True)]
		
	if errors:
		sendmail_to_system_managers("ERPNext Scheduler Failure Report", ("""
	<p>Dear System Managers,</p>
	<p>Reporting ERPNext failed scheduler events for the day (max 10):</p>
	<p>URL: <a href="%(url)s" target="_blank">%(url)s</a></p><hr>""" % {"url":get_url()}) + "<hr>".join(errors))
开发者ID:cswaroop,项目名称:erpnext,代码行数:15,代码来源:scheduler.py


示例11: update_message

	def update_message(doc):
		from webnotes.utils import get_url
		import urllib
		updated = message + """<div style="padding: 7px; border-top: 1px solid #aaa;
			margin-top: 17px;">
			<small><a href="%s/?%s">
			Unsubscribe</a> from this list.</small></div>""" % (get_url(), 
			urllib.urlencode({
				"cmd": "webnotes.utils.email_lib.bulk.unsubscribe",
				"email": doc.get(email_field),
				"type": doctype,
				"email_field": email_field
			}))
			
		return updated
开发者ID:ricardomomm,项目名称:wnframework,代码行数:15,代码来源:bulk.py


示例12: set_portal_link

def set_portal_link(sent_via, comm):
	"""set portal link in footer"""

	footer = None

	if is_signup_enabled() and hasattr(sent_via, "get_portal_page"):
		portal_page = sent_via.get_portal_page()
		if portal_page:
			is_valid_recipient = cstr(sent_via.doc.email or sent_via.doc.email_id or
				sent_via.doc.contact_email) in comm.recipients
			if is_valid_recipient:
				url = "%s/%s?name=%s" % (get_url(), portal_page, urllib.quote(sent_via.doc.name))
				footer = """<!-- Portal Link --><hr>
						<a href="%s" target="_blank">View this on our website</a>""" % url
	
	return footer
开发者ID:bindscha,项目名称:wnframework_old,代码行数:16,代码来源:communication.py


示例13: get_error_report

def get_error_report(from_date=None, to_date=None, limit=10):
	from webnotes.utils import get_url, now_datetime, add_days
	
	if not from_date:
		from_date = add_days(now_datetime().date(), -1)
	if not to_date:
		to_date = add_days(now_datetime().date(), -1)
	
	errors = get_errors(from_date, to_date, limit)
	
	if errors:
		return 1, """<h4>Scheduler Failed Events (max {limit}):</h4>
			<p>URL: <a href="{url}" target="_blank">{url}</a></p><hr>{errors}""".format(
			limit=limit, url=get_url(), errors="<hr>".join(errors))
	else:
		return 0, "<p>Scheduler didn't encounter any problems.</p>"
开发者ID:Halfnhav,项目名称:wnframework,代码行数:16,代码来源:scheduler.py


示例14: update_message

	def update_message(formatted, doc, add_unsubscribe_link):
		updated = formatted
		if add_unsubscribe_link:
			unsubscribe_link = """<div style="padding: 7px; border-top: 1px solid #aaa;
				margin-top: 17px;">
				<small><a href="%s/?%s">
				Unsubscribe</a> from this list.</small></div>""" % (get_url(), 
				urllib.urlencode({
					"cmd": "webnotes.utils.email_lib.bulk.unsubscribe",
					"email": doc.get(email_field),
					"type": doctype,
					"email_field": email_field
				}))
						
			updated = updated.replace("<!--unsubscribe link here-->", unsubscribe_link)
			
		return updated
开发者ID:bindscha,项目名称:wnframework_old,代码行数:17,代码来源:bulk.py


示例15: notify

def notify(arg=None):
	from webnotes.utils import cstr, get_fullname, get_url
	
	fn = get_fullname(webnotes.user.name) or webnotes.user.name
	
	url = get_url()
	
	message = '''You have a message from <b>%s</b>:
	
	%s
	
	To answer, please login to your erpnext account at \
	<a href=\"%s\" target='_blank'>%s</a>
	''' % (fn, arg['txt'], url, url)
	
	sender = webnotes.conn.get_value("Profile", webnotes.user.name, "email") \
		or webnotes.user.name
	recipient = [webnotes.conn.get_value("Profile", arg["contact"], "email") \
		or arg["contact"]]
	
	from webnotes.utils.email_lib import sendmail
	sendmail(recipient, sender, message, arg.get("subject") or "You have a message from %s" % (fn,))
	
开发者ID:Yellowen,项目名称:wnframework,代码行数:22,代码来源:messages.py


示例16: 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.get_url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.getdate函数代码示例发布时间:2022-05-26
下一篇:
Python utils.get_last_day函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap