Example #1
0
    def get_context(self, context):
        # this is for double precaution. usually it wont reach this code if not published
        if not cint(self.published):
            raise Exception, "This blog has not been published yet!"

        # temp fields
        context.full_name = get_fullname(self.owner)
        context.updated = global_date_format(self.published_on)

        if self.blogger:
            context.blogger_info = frappe.get_doc("Blogger",
                                                  self.blogger).as_dict()

        context.description = self.blog_intro or self.content[:140]

        context.metatags = {
            "name": self.title,
            "description": context.description,
        }

        image = find_first_image(self.content)
        if image:
            context.metatags["image"] = image

        context.categories = frappe.db.sql_list("""select name from
			`tabBlog Category` order by name""")

        context.comment_list = get_comment_list(self.doctype, self.name)

        context.children = get_children()

        return context
Example #2
0
	def get_context(self, context):
		# this is for double precaution. usually it wont reach this code if not published
		if not cint(self.published):
			raise Exception, "This blog has not been published yet!"

		# temp fields
		context.full_name = get_fullname(self.owner)
		context.updated = global_date_format(self.published_on)

		if self.blogger:
			context.blogger_info = frappe.get_doc("Blogger", self.blogger).as_dict()

		context.description = self.blog_intro or self.content[:140]

		context.metatags = {
			"name": self.title,
			"description": context.description,
		}

		image = find_first_image(self.content)
		if image:
			context.metatags["image"] = image

		context.categories = frappe.db.sql_list("""select name from
			`tabBlog Category` order by name""")

		context.comment_list = get_comment_list(self.doctype, self.name)

		context.children = get_children()

		return context
Example #3
0
	def get_children(self):
		return get_children()
Example #4
0
	def get_children(self, context=None):
		return get_children()