'if user is set, then update all older blogs'

def on_update(self):

    from frappe.website.doctype.blog_post.blog_post import clear_blog_cache
    clear_blog_cache()
    if self.user:
        for blog in frappe.db.sql_list(u"select    name    from    `tabBlog    Post`    where    owner=%s\n DCTB  DCTB  DCTB  DCTB and    ifnull(blogger,'')=''", self.user):
            b = frappe.get_doc(u'Blog    Post', blog)
            b.blogger = self.name
            b.save()
        frappe.permissions.add_user_permission(u'Blogger', self.name, self.user)
