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


Python utils.get_fullname函数代码示例

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


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

示例1: on_update

	def on_update(self):
		clear_unit_views(self.doc.unit)

		if self.doc.assigned_to and self.doc.assigned_to != self.assigned_to \
			and webnotes.session.user != self.doc.assigned_to:
			
			# send assignment email
			sendmail(recipients=[self.doc.assigned_to], 
				subject="You have been assigned this Task by {}".format(get_fullname(self.doc.modified_by)),
				msg=self.get_reply_email_message(get_fullname(self.doc.owner)))
开发者ID:butu5,项目名称:aapkamanch,代码行数:10,代码来源:post.py

示例2: on_update

	def on_update(self):
		clear_cache(website_group=self.doc.website_group)
		clear_post_cache(self.doc.parent_post or self.doc.name)

		if self.doc.assigned_to and self.doc.assigned_to != self.assigned_to \
			and webnotes.session.user != self.doc.assigned_to:
			
			# send assignment email
			sendmail(recipients=[self.doc.assigned_to], 
				subject="You have been assigned this Task by {}".format(get_fullname(self.doc.modified_by)),
				msg=self.get_reply_email_message(self.doc.name, get_fullname(self.doc.owner)))
开发者ID:bindscha,项目名称:wnframework_old,代码行数:11,代码来源:post.py

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

示例4: get_blog_list

def get_blog_list(args=None):
	"""
		args = {
			'start': 0,
		}
	"""
	import webnotes
	
	if not args: args = webnotes.form_dict
	
	query = """\
		select
			name, page_name, content, owner, creation as creation,
			title, (select count(name) from `tabComment` where
				comment_doctype='Blog' and comment_docname=`tabBlog`.name) as comments
		from `tabBlog`
		where ifnull(published,0)=1
		order by creation desc, name asc
		limit %s, 5""" % args.start
		
	result = webnotes.conn.sql(query, args, as_dict=1)

	# strip html tags from content
	import webnotes.utils
	
	for res in result:
		from webnotes.utils import global_date_format, get_fullname
		res['full_name'] = get_fullname(res['owner'])
		res['published'] = global_date_format(res['creation'])
		if not res['content']:
			res['content'] = website.utils.get_html(res['page_name'])
		res['content'] = split_blog_content(res['content'])

	return result
开发者ID:MiteshC,项目名称:erpnext,代码行数:34,代码来源:blog.py

示例5: prepare_template_args

	def prepare_template_args(self):
		import webnotes.utils
		
		# this is for double precaution. usually it wont reach this code if not published
		if not webnotes.utils.cint(self.doc.published):
			raise Exception, "This blog has not been published yet!"
		
		# temp fields
		from webnotes.utils import global_date_format, get_fullname
		self.doc.full_name = get_fullname(self.doc.owner)
		self.doc.updated = global_date_format(self.doc.published_on)
		self.doc.content_html = self.doc.content
		if self.doc.blogger:
			self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
		
		self.doc.description = self.doc.blog_intro or self.doc.content[:140]
		
		self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
		
		self.doc.texts = {
			"comments": _("Comments"),
			"first_comment": _("Be the first one to comment"),
			"add_comment": _("Add Comment"),
			"submit": _("Submit"),
			"all_posts_by": _("All posts by"),
		}

		comment_list = webnotes.conn.sql("""\
			select comment, comment_by_fullname, creation
			from `tabComment` where comment_doctype="Blog Post"
			and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
		
		self.doc.comment_list = comment_list or []
		for comment in self.doc.comment_list:
			comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])
开发者ID:BillTheBest,项目名称:erpnext,代码行数:35,代码来源:blog_post.py

示例6: get_context

def get_context():
	post_name = webnotes.request.path[1:].split("/")[1]
	post = webnotes.bean("Post", post_name).doc
	
	access = get_access(post.unit)
	if not access.get("read"):
		return {
			"name": "Not Permitted",
			"title": "Not Permitted",
			"post_list_html": "<div class='text-muted'>You are not permitted to view this page</div>",
			"not_permitted": True
		}
	
	fullname = get_fullname(post.owner)
	title = "{post} by {fullname}".format(unit=post.unit, post="Post", fullname=fullname)
	unit = webnotes.bean("Unit", post.unit).doc
	parents = webnotes.conn.sql("""select name, unit_title from tabUnit 
		where lft <= %s and rgt >= %s order by lft asc""", (unit.lft, unit.rgt), as_dict=1)
	
	return {
		"name": post.unit,
		"title": title,
		"parent_post_html": get_parent_post_html(post, access),
		"post_list_html": get_child_posts_html(post),
		"parents": parents,
		"parent_post": post.name
	}
开发者ID:butu5,项目名称:aapkamanch,代码行数:27,代码来源:post.py

示例7: get_context

	def get_context(self):
		import webnotes.utils
		import markdown2
		
		# this is for double precaution. usually it wont reach this code if not published
		if not webnotes.utils.cint(self.doc.published):
			raise Exception, "This blog has not been published yet!"
		
		# temp fields
		from webnotes.utils import global_date_format, get_fullname
		self.doc.full_name = get_fullname(self.doc.owner)
		self.doc.updated = global_date_format(self.doc.published_on)
		
		if self.doc.blogger:
			self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
		
		self.doc.description = self.doc.blog_intro or self.doc.content[:140]
		self.doc.meta_description = self.doc.description
		
		self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
		
		self.doc.comment_list = webnotes.conn.sql("""\
			select comment, comment_by_fullname, creation
			from `tabComment` where comment_doctype="Blog Post"
			and comment_docname=%s order by creation""", self.doc.name, as_dict=1) or []
开发者ID:Halfnhav,项目名称:wnframework,代码行数:25,代码来源:blog_post.py

示例8: assign_post

def assign_post(post, profile=None):
	post = webnotes.bean("Post", post)

	if not get_access(post.doc.unit).get("write"):
		raise webnotes.PermissionError("You are not allowed edit this post")
	
	if profile and not get_access(post.doc.unit, profile).get("write"):
		raise webnotes.PermissionError("Selected user does not have 'write' access to this post")
		
	if profile and post.doc.assigned_to:
		webnotes.throw("Someone is already assigned to this post. Please refresh.")
		
	if not profile and post.doc.status == "Completed":
		webnotes.throw("You cannot revoke assignment of a completed task.")
		
	post.doc.status = "Assigned" if profile else None
	
	post.doc.assigned_to = profile
	post.doc.assigned_to_fullname = get_fullname(profile) if profile else None
	
	post.ignore_permissions = True
	post.save()
	
	return {
		"post_settings_html": get_post_settings(post.doc.unit, post.doc.name),
		"assigned_to_fullname": post.doc.assigned_to_fullname,
		"status": post.doc.status
	}
开发者ID:rmehta,项目名称:aapkamanch,代码行数:28,代码来源:post.py

示例9: validate_leave_approver

    def validate_leave_approver(self):
        employee = webnotes.bean("Employee", self.doc.employee)
        leave_approvers = [l.leave_approver for l in employee.doclist.get({"parentfield": "employee_leave_approvers"})]

        if len(leave_approvers) and self.doc.leave_approver not in leave_approvers:
            msgprint(
                (
                    "["
                    + _("For Employee")
                    + ' "'
                    + self.doc.employee
                    + '"] '
                    + _("Leave Approver can be one of")
                    + ": "
                    + comma_or(leave_approvers)
                ),
                raise_exception=InvalidLeaveApproverError,
            )

        elif self.doc.leave_approver and not webnotes.conn.sql(
            """select name from `tabUserRole` 
			where parent=%s and role='Leave Approver'""",
            self.doc.leave_approver,
        ):
            msgprint(
                get_fullname(self.doc.leave_approver) + ": " + _("does not have role 'Leave Approver'"),
                raise_exception=InvalidLeaveApproverError,
            )
开发者ID:nabinhait,项目名称:erpnext,代码行数:28,代码来源:leave_application.py

示例10: validate

	def validate(self):
		"""write/update 'Page' with the blog"""		
		p = website.utils.add_page(self.doc.title)
		self.doc.name = p.name
		
		from jinja2 import Template
		import markdown2
		import os
		from webnotes.utils import global_date_format, get_fullname
		
		self.doc.content_html = markdown2.markdown(self.doc.content or '')
		self.doc.full_name = get_fullname(self.doc.owner)
		self.doc.updated = global_date_format(self.doc.modified)
		
		with open(os.path.join(os.path.dirname(__file__), 'template.html'), 'r') as f:
			p.content = Template(f.read()).render(doc=self.doc)
		
		with open(os.path.join(os.path.dirname(__file__), 'blog_page.js'), 'r') as f:
			p.script = Template(f.read()).render(doc=self.doc)
				
		p.save()
		
		website.utils.add_guest_access_to_page(p.name)
		
		# cleanup
		for f in ['content_html', 'full_name', 'updated']:
			if f in self.doc.fields:
				del self.doc.fields[f]
开发者ID:antoxin,项目名称:erpnext,代码行数:28,代码来源:blog.py

示例11: add

def add():
	"""add in someone's to do list"""
	if webnotes.conn.sql("""select owner from `tabToDo Item`
		where reference_type=%(doctype)s and reference_name=%(name)s
		and owner=%(assign_to)s""", webnotes.form_dict):
		webnotes.msgprint("Already in todo")
		return
	else:
		from webnotes.model.doc import Document
		from webnotes.utils import nowdate
		
		d = Document("ToDo Item")
		d.owner = webnotes.form_dict['assign_to']
		d.reference_type = webnotes.form_dict['doctype']
		d.reference_name = webnotes.form_dict['name']
		d.description = webnotes.form_dict['description']
		d.priority = webnotes.form_dict.get('priority', 'Medium')
		d.date = webnotes.form_dict.get('date', nowdate())
		d.assigned_by = webnotes.user.name
		d.save(1)

	# notify
	notify_assignment(d.assigned_by, d.owner, d.reference_type, d.reference_name, action='ASSIGN', notify=webnotes.form_dict.get('notify'))
		
	# update feeed
	try:
		import home
		from webnotes.utils import get_fullname
		home.make_feed('Assignment', d.reference_type, d.reference_name, webnotes.session['user'],
			'[%s] Assigned to %s' % (d.priority, get_fullname(d.owner)), '#C78F58')
	except ImportError, e:
		pass
开发者ID:beliezer,项目名称:wnframework,代码行数:32,代码来源:assign_to.py

示例12: _get_post_context

	def _get_post_context():
		fullname = get_fullname(post.owner)
		return {
			"title": "{} by {}".format(post.title, fullname),
			# "group_title": group_context.get("unit_title") + " by {}".format(fullname),
			"parent_post_html": get_parent_post_html(post, group_context.get("view")),
			"post_list_html": get_child_posts_html(post, group_context.get("view")),
			"parent_post": post.name
		}
开发者ID:bindscha,项目名称:wnframework_old,代码行数:9,代码来源:post.py

示例13: add

def add(args=None):
	"""add in someone's to do list"""
	if not args:
		args = webnotes.local.form_dict
		
	if webnotes.conn.sql("""select owner from `tabToDo`
		where reference_type=%(doctype)s and reference_name=%(name)s and status="Open"
		and owner=%(assign_to)s""", args):
		webnotes.msgprint("Already in todo", raise_exception=True)
		return
	else:
		from webnotes.utils import nowdate
		
		d = webnotes.bean({
			"doctype":"ToDo",
			"owner": args['assign_to'],
			"reference_type": args['doctype'],
			"reference_name": args['name'],
			"description": args.get('description'),
			"priority": args.get("priority", "Medium"),
			"status": "Open",
			"date": args.get('date', nowdate()),
			"assigned_by": args.get('assigned_by', webnotes.user.name),
		}).insert(ignore_permissions=True).doc
		
		# set assigned_to if field exists
		from webnotes.model.meta import has_field
		if has_field(args['doctype'], "assigned_to"):
			webnotes.conn.set_value(args['doctype'], args['name'], "assigned_to", args['assign_to'])
			
	try:
		if cint(args.get("restrict")):
			from webnotes.core.page.user_properties import user_properties
			user_properties.add(args['assign_to'], args['doctype'], args['name'])
			webnotes.msgprint(_("Restriction added"))
	except webnotes.PermissionError:
		webnotes.throw("{cannot}: {user}, {_for}: {doctype} {_and}: {name}".format(cannot=_("You cannot restrict User"), 
			user=args['assign_to'], _for=_("for DocType"), doctype=_(args['doctype']), _and=_("and Name"),
			name=args['name']))

	# notify
	if not args.get("no_notification"):
		notify_assignment(d.assigned_by, d.owner, d.reference_type, d.reference_name, action='ASSIGN', description=args.get("description"), notify=args.get('notify'))
		
	# update feeed
	try:
		from erpnext.home import make_feed
		from webnotes.utils import get_fullname
		make_feed('Assignment', d.reference_type, d.reference_name, webnotes.session['user'],
			'[%s] Assigned to %s' % (d.priority, get_fullname(d.owner)), '#C78F58')
	except ImportError, e:
		pass
开发者ID:bindscha,项目名称:wnframework_old,代码行数:52,代码来源:assign_to.py

示例14: move_remarks_to_comments

def move_remarks_to_comments():
	from webnotes.utils import get_fullname
	result = webnotes.conn.sql("""select name, remark, modified_by from `tabStock Reconciliation`
		where ifnull(remark, '')!=''""")
	fullname_map = {}
	for reco, remark, modified_by in result:
		webnotes.bean([{
			"doctype": "Comment",
			"comment": remark,
			"comment_by": modified_by,
			"comment_by_fullname": fullname_map.setdefault(modified_by, get_fullname(modified_by)),
			"comment_doctype": "Stock Reconciliation",
			"comment_docname": reco
		}]).insert()
开发者ID:BillTheBest,项目名称:erpnext,代码行数:14,代码来源:stock_reconciliation_patch.py

示例15: send_email_on_reply

	def send_email_on_reply(self):
		owner_fullname = get_fullname(self.doc.owner)
		
		parent_post = webnotes.bean("Post", self.doc.parent_post).doc
		
		message = self.get_reply_email_message(owner_fullname)
		
		# send email to the owner of the post, if he/she is different
		if parent_post.owner != self.doc.owner:
			send(recipients=[parent_post.owner], 
				subject="{someone} replied to your post".format(someone=owner_fullname), 
				message=message,
			
				# to allow unsubscribe
				doctype='Profile', 
				email_field='name', 
				
				# for tracking sent status
				ref_doctype=self.doc.doctype, ref_docname=self.doc.name)
		
		# send email to members who part of the conversation
		recipients = webnotes.conn.sql_list("""select owner from `tabPost`
			where parent_post=%s and owner not in (%s, %s)""", 
			(self.doc.parent_post, parent_post.owner, self.doc.owner))
		
		send(recipients=recipients, 
			subject="{someone} replied to a post by {other}".format(someone=owner_fullname, 
				other=get_fullname(parent_post.owner)), 
			message=message,
		
			# to allow unsubscribe
			doctype='Profile', 
			email_field='name', 
			
			# for tracking sent status
			ref_doctype=self.doc.doctype, ref_docname=self.doc.name)
开发者ID:butu5,项目名称:aapkamanch,代码行数:36,代码来源:post.py


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