Created
March 21, 2016 12:51
-
-
Save s3341458/cfdd550a7cd1ce8c4c14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@notification_func | |
def draft_sent(draft): | |
uri = backend.views.app.config['FRONTEND_URI'] | |
link = "{0}jobs/{1}/drafting/client/" | |
link = link.format(uri, draft.job.id) | |
link_with_client_token = link + "?client_token={}".\ | |
format(draft.job.client.client_token) | |
html = render_template('drafting/draft_sent.html', draft.job.domain.theme, | |
draft=draft, link=link_with_client_token) | |
short_url_obj = ShortUrls(link, draft.job.client) | |
short_url = backend.views.app.build_short_url(short_url_obj.prefix_token) | |
print "debug here:", flask.url_for("short_url_render", | |
prefix_token=short_url_obj.prefix_token, | |
suffix_token=short_url_obj.suffix_token) | |
description = u"Job #{} new draft waiting for approval!".\ | |
format(draft.job.id) | |
domain = draft.job.domain | |
msg = u"Job #{0} has a new draft ready for your review. Please " \ | |
u"follow the link {1} provided to view your draft.".\ | |
format(draft.job.id, short_url) | |
notifier.notify(draft.job.client, description, msg, html_message=html, | |
section=sources.JOB_DESIGN, domain=domain, | |
related_draft=draft, notification_type=DRAFT_SENT, | |
related_job=draft.job, link=link, email=draft.send_email, | |
sms=draft.send_sms, short_url=short_url_obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment