本文整理汇总了Python中will.decorators.rendered_template函数的典型用法代码示例。如果您正苦于以下问题:Python rendered_template函数的具体用法?Python rendered_template怎么用?Python rendered_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rendered_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: pipedrive_notification
def pipedrive_notification(self):
"""Web hook push notification endpoint from Pipedrive subscription(s) when a deal moves.
https://developers.pipedrive.com/v1#methods-PushNotifications / REST Hooks / Web hooks
"""
assert self.request.json and "current" in self.request.json and "previous" in self.request.json
body = self.request.json
payload = self.generate_payload(body)
if not self._passes_through_whitelist_blacklist(body['current']):
return 'OK'
if self._pipedrive_deal_status_won(body):
message = rendered_template("pipedrive_won.html", context=payload)
self.say(message, html=True, color="green")
elif self._pipedrive_deal_status_lost(body):
message = rendered_template("pipedrive_lost.html", context=payload)
self.say(message, html=True, color="red")
elif self._pipedrive_deal_stage_changed(body):
message = rendered_template("pipedrive_update.html", context=payload)
self.say(message, html=True, color="green")
return 'OK'
开发者ID:buddyup,项目名称:our-will,代码行数:25,代码来源:pipedrive.py
示例2: get_uid
def get_uid(self, message, mention=None):
if mention !='@all':
hipchat_user_details = HipChatMixin().get_hipchat_user(user_id=mention)
sender_email = hipchat_user_details.get('email')
context = stats(user_name=sender_email)
self.say(rendered_template("group_user.html", context), message, html=True)
else:
context = group_stats()
self.say("@all Group Stats",message, notify=True, color='green')
self.say(rendered_template("group_stats.html", context),message, notify=True,
color='green', html=True)
开发者ID:appliedinfo,项目名称:will,代码行数:11,代码来源:custom_messages.py
示例3: search
def search(self, message, module, query):
self.say("Alright, I'm on it...", message=message)
accounts_words = ['accounts', 'businesses', 'companies']
contacts_words = ['contacts', 'people']
module = lower(module)
last_name = None
if module in accounts_words:
module = 'Accounts'
return_fields = ['Account Name', 'Phone', 'Company Site']
elif module in contacts_words:
module = 'Contacts'
return_fields = ['First Name', 'Last Name', 'Phone', 'Email']
if len(split(query, ' ')) > 1:
first_name = get_first_name(query)
last_name = get_last_name(query)
query = first_name
else:
self.say("I don't know of any '%s' module in Zoho" % module, message=message)
return None
record_ids = self.get_search_records(module, return_fields, query)
results = []
for record_id in record_ids:
record = self.get_record_by_id(record_id, module, return_fields)
record_fields = []
ignore_fields = ['ACCOUNTID', 'CONTACTID']
skip_record = False
for field in record:
for field_label in field:
if field_label not in ignore_fields:
field_value = field[field_label]
record_fields.append(field_value)
if field_label == 'Last Name' and last_name is not None:
if not lower(last_name) in lower(field_value):
skip_record = True
if not skip_record:
result = join(record_fields, ', ')
results.append(result)
results_context = {
'results': results,
'module': module,
'query': query,
'count': len(results)
}
results_html = rendered_template("zoho_search_results.html", results_context)
self.say(results_html, html=True, message=message)
return results_context
开发者ID:michaeljoseph,项目名称:our-will,代码行数:60,代码来源:zoho_crm.py
示例4: google_poem
def google_poem(self, message, topic):
"""make a poem about __: show a google poem about __"""
r = requests.get("http://www.google.com/complete/search?output=toolbar&q=" + topic + "%20")
xmldoc = minidom.parseString(r.text)
item_list = xmldoc.getElementsByTagName("suggestion")
context = {"topic": topic, "lines": [x.attributes["data"].value for x in item_list[:4]]}
self.say(rendered_template("gpoem.html", context), message, html=True)
开发者ID:CodeMonk,项目名称:will,代码行数:7,代码来源:googlepoem.py
示例5: hear_dkcwd_team_timezones
def hear_dkcwd_team_timezones(self, message):
context = {
"date": time.strftime('%Y%m%d')
}
self.say(rendered_template("dkcwd_team_timezone_times.html", context), message=message, html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:7,代码来源:examples.py
示例6: packt_book_of_the_day_new_available
def packt_book_of_the_day_new_available(self):
context = {
"book": self.get_packt_book_of_the_day_name()
}
self.say(rendered_template("dkcwd_packt_book_of_the_day_new_available.html", context), html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:7,代码来源:examples.py
示例7: packt_book_of_the_day_almost_over
def packt_book_of_the_day_almost_over(self):
context = {
"book": self.get_packt_book_of_the_day_name()
}
self.say(rendered_template("dkcwd_packt_book_of_the_day_almost_over.html", context), html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:7,代码来源:examples.py
示例8: hear_packt_book_of_the_day
def hear_packt_book_of_the_day(self, message):
context = {
"book": self.get_packt_book_of_the_day_name()
}
self.say(rendered_template("dkcwd_packt_book_of_the_day.html", context), message=message, html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:7,代码来源:examples.py
示例9: available_branches
def available_branches(self, message):
"""list deployable branches: list all the branches that can be deployed"""
print "available_branches"
repos = self.get_github_deployable_repos()
context = {"repos": repos}
branches_html = rendered_template("available_branches.html", context)
self.say(branches_html, message=message, html=True)
开发者ID:imclab,项目名称:our-will,代码行数:7,代码来源:staging.py
示例10: list_rooms
def list_rooms(self, message):
"""what are the rooms?: List all the rooms I know about."""
if len(self.available_rooms.keys()) >= 100:
context = {"rooms": self.available_rooms.values()[0:100]}
else:
context = {"rooms": self.available_rooms.values(), }
self.say(rendered_template("rooms.html", context), message=message, html=True)
开发者ID:asecurityteam,项目名称:will,代码行数:7,代码来源:rooms.py
示例11: respond_to_contact_info
def respond_to_contact_info(self, message):
contacts = self.load("contact_info", {})
context = {
"contacts": contacts,
}
contact_html = rendered_template("contact_info.html", context)
self.say(contact_html)
开发者ID:michaeljoseph,项目名称:our-will,代码行数:7,代码来源:contacts.py
示例12: remind_staging_servers
def remind_staging_servers(self):
context = {
"stacks": self.stacks,
"no_stacks": self.stacks == {}
}
servers_html = rendered_template("active_staging_server_reminder.html", context)
self.say(servers_html, html=True)
开发者ID:michaeljoseph,项目名称:our-will,代码行数:7,代码来源:staging.py
示例13: render_lp
def render_lp(self, bug):
bug_info = {
'link': bug.web_link,
'title': bug.title,
'milestones': []
}
for task in bug.bug_tasks:
task_info = {
'status': 'Unknown',
'assignee': 'None',
'title': 'None'
}
try:
(task_info['status'], ) = task.status
except Exception:
pass
try:
task_info['assignee'] = task.assignee.name
except Exception:
pass
try:
task_info['title'] = task.target.name
except Exception:
pass
bug_info['milestones'].append(task_info)
return rendered_template("lp_bug.html", bug_info)
开发者ID:grahamhayes,项目名称:will,代码行数:30,代码来源:launchpad.py
示例14: group_users
def group_users(self, message):
response = requests.get(
settings.FIT_BOT_URL + 'get_group_users/1/')
data = response.json()
userlist = data.get('userlist', '')
context = {"userlist": userlist}
self.say(rendered_template("group_users.html", context), message, html=True)
开发者ID:appliedinfo,项目名称:will,代码行数:7,代码来源:custom_messages.py
示例15: hear_dkcwd_team_escalation_process
def hear_dkcwd_team_escalation_process(self, message):
context = {
"link": 'some web address',
"text": 'Here is the link to the escalation process'
}
self.say(rendered_template("dkcwd_generic_team_link.html", context), message=message, html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:8,代码来源:examples.py
示例16: tutor_application
def tutor_application(self):
assert self.request.json and "user_name" in self.request.json
payload = self.request.json
message = rendered_template("tutor_application.html", context=payload)
color = "green"
self.say(message, color=color)
return "OK"
开发者ID:buddyup,项目名称:our-will,代码行数:8,代码来源:product.py
示例17: event_added
def event_added(self):
assert self.request.json and "event_name" in self.request.json
payload = self.request.json
message = rendered_template("event_added.html", context=payload)
color = "green"
self.say(message, color=color)
return "OK"
开发者ID:buddyup,项目名称:our-will,代码行数:8,代码来源:product.py
示例18: hear_dkcwd_mom_number
def hear_dkcwd_mom_number(self, message):
context = {
"link": 'https://www.youtube.com/watch?v=AhYP7HSKiGc',
"text": 'Here is the only link you need'
}
self.say(rendered_template("dkcwd_generic_team_link.html", context), message=message, html=True, notify=True)
开发者ID:dkcwd,项目名称:docker-willbot-example,代码行数:8,代码来源:examples.py
示例19: respond_to_contact_info
def respond_to_contact_info(self, message):
"""contact info: Show everyone's emergency contact info."""
contacts = self.load("contact_info", {})
context = {
"contacts": contacts,
}
contact_html = rendered_template("contact_info.html", context)
self.say(contact_html, message=message)
开发者ID:AirbornePorcine,项目名称:will,代码行数:8,代码来源:emergency_contacts.py
示例20: seriously_remind_staging_servers
def seriously_remind_staging_servers(self):
if self.stacks != {}:
context = {
"stacks": self.stacks,
"no_stacks": self.stacks == {}
}
servers_html = rendered_template("active_staging_server_reminder.html", context)
self.say(servers_html, html=True, color="red")
开发者ID:imclab,项目名称:our-will,代码行数:8,代码来源:staging.py
注:本文中的will.decorators.rendered_template函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论