本文整理汇总了Python中genshi.template.text.NewTextTemplate.encode方法的典型用法代码示例。如果您正苦于以下问题:Python NewTextTemplate.encode方法的具体用法?Python NewTextTemplate.encode怎么用?Python NewTextTemplate.encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类genshi.template.text.NewTextTemplate
的用法示例。
在下文中一共展示了NewTextTemplate.encode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format_subj
# 需要导入模块: from genshi.template.text import NewTextTemplate [as 别名]
# 或者: from genshi.template.text.NewTextTemplate import encode [as 别名]
def format_subj(self, summary):
template = self.config.get("notification", "ticket_subject_template")
template = NewTextTemplate(template.encode("utf8"))
prefix = self.config.get("notification", "smtp_subject_prefix")
if prefix == "__default__":
prefix = "[%s]" % self.env.project_name
data = {"prefix": prefix, "summary": summary, "ticket": self.ticket, "env": self.env}
return template.generate(**data).render("text", encoding=None).strip()
示例2: format_subj
# 需要导入模块: from genshi.template.text import NewTextTemplate [as 别名]
# 或者: from genshi.template.text.NewTextTemplate import encode [as 别名]
def format_subj(self, tickets_descr):
template = self.config.get('notification','batch_subject_template')
template = NewTextTemplate(template.encode('utf8'))
prefix = self.config.get('notification', 'smtp_subject_prefix')
if prefix == '__default__':
prefix = '[%s]' % self.env.project_name
data = {
'prefix': prefix,
'tickets_descr': tickets_descr,
'env': self.env,
}
return template.generate(**data).render('text', encoding=None).strip()
示例3: format_subject
# 需要导入模块: from genshi.template.text import NewTextTemplate [as 别名]
# 或者: from genshi.template.text.NewTextTemplate import encode [as 别名]
def format_subject(self, action):
template = self.config.get('wiki-notification', 'subject_template')
template = NewTextTemplate(template.encode('utf8'))
prefix = self.config.get('notification', 'smtp_subject_prefix')
if prefix == '__default__':
prefix = '[%s]' % self.config.get('project', 'name')
data = {
'pagename': self.old_name or self.page.name,
'prefix': prefix,
'action': action,
'env': self.env,
}
return template.generate(**data).render('text', encoding=None).strip()
示例4: format_subj
# 需要导入模块: from genshi.template.text import NewTextTemplate [as 别名]
# 或者: from genshi.template.text.NewTextTemplate import encode [as 别名]
def format_subj(self, summary, newticket=True):
template = self.config.get('notification', 'ticket_subject_template')
template = NewTextTemplate(template.encode('utf8'))
prefix = self.config.get('notification', 'smtp_subject_prefix')
if prefix == '__default__':
prefix = '[%s]' % self.env.project_name
data = {
'prefix': prefix,
'summary': summary,
'ticket': self.ticket,
'env': self.env,
}
subj = template.generate(**data).render('text', encoding=None).strip()
if not newticket:
subj = "Re: " + subj
return subj