forked from danatierney/hd-events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notices.py
176 lines (134 loc) · 4.41 KB
/
notices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
from google.appengine.api import mail
from django.template.defaultfilters import slugify
from google.appengine.ext import deferred
import random
import os
FROM_ADDRESS = 'Dojo Events <[email protected]>'
NEW_EVENT_ADDRESS = '[email protected]'
STAFF_ADDRESS = '[email protected]'
def bug_owner_pending(e):
body = """
Event: %s
Owner: %s
Date: %s
URL: http://%s/event/%s-%s
""" % (
e.name,
str(e.member),
e.start_time.strftime('%A, %B %d'),
os.environ.get('HTTP_HOST'),
e.key().id(),
slugify(e.name),)
if not e.is_approved():
body += """
Alert! The events team has not approved your event yet.
Please e-mail them at [email protected] to see whats up.
"""
body += """
Cheers,
Hacker Dojo Events Team
"""
deferred.defer(mail.send_mail, sender=FROM_ADDRESS, to=e.member.email(),
subject="[Pending Event] Your event is still pending: " + e.name,
body=body, _queue="emailthrottle")
def schedule_reminder_email(e):
body = """
*REMINDER*
Event: %s
Owner: %s
Date: %s
URL: http://%s/event/%s-%s
""" % (
e.name,
str(e.owner()),
e.start_time.strftime('%A, %B %d'),
os.environ.get('HTTP_HOST'),
e.key().id(),
slugify(e.name),)
body += """
Hello! Friendly reminder that your event is scheduled to happen at Hacker Dojo.
* The person named above must be physically present
* If the event has been cancelled, resecheduled or moved, you must login and cancel the event on our system
Cheers,
Hacker Dojo Events Team
"""
deferred.defer(mail.send_mail, sender=FROM_ADDRESS, to=e.member.email(),
subject="[Event Reminder] " + e.name,
body=body, _queue="emailthrottle")
def notify_owner_confirmation(event):
deferred.defer(mail.send_mail ,sender=FROM_ADDRESS, to=event.member.email(),
subject="[New Event] Submitted but **not yet approved**",
body="""This is a confirmation that your event:
%s
on %s
has been submitted to be approved. You will be notified as soon as it's
approved and on the calendar. Here is a link to the event page:
http://events.hackerdojo.com/event/%s-%s
Again, your event is NOT YET APPROVED and not on the calendar.
Cheers,
Hacker Dojo Events Team
""" % (
event.name,
event.start_time.strftime('%A, %B %d'),
event.key().id(),
slugify(event.name),))
def notify_new_event(event):
deferred.defer(mail.send_mail, sender=FROM_ADDRESS, to=NEW_EVENT_ADDRESS,
subject='[New Event] %s on %s' % (event.name, event.start_time.strftime('%a %b %d')),
body="""Event: %s
Member: %s
When: %s to %s
Type: %s
Size: %s
Rooms: %s
Contact: %s (%s)
URL: %s
Fee: %s
Details: %s
Notes: %s
http://events.hackerdojo.com/event/%s-%s
""" % (
event.name,
event.member.email(),
event.start_time.strftime('%I:%M%p'),
event.end_time.strftime('%I:%M%p'),
event.type,
event.estimated_size,
event.roomlist(),
event.contact_name,
event.contact_phone,
event.url,
event.fee,
event.details,
event.notes,
event.key().id(),
slugify(event.name),))
def notify_owner_approved(event):
deferred.defer(mail.send_mail,sender=FROM_ADDRESS, to=event.member.email(),
subject="[Event Approved] %s" % event.name,
body="""Your event is approved and on the calendar!
Friendly Reminder: You must be present at the event and make sure Dojo policies are followed.
Note: If you cancel or reschedule the event, please log in to our system and cancel the event!
http://events.hackerdojo.com/event/%s-%s
Cheers,
Hacker Dojo Events Team
""" % (event.key().id(), slugify(event.name)))
def notify_owner_rsvp(event,user):
deferred.defer(mail.send_mail,sender=FROM_ADDRESS, to=event.member.email(),
subject="[Event RSVP] %s" % event.name,
body="""Good news! %s <%s> has RSVPd to your event.
Friendly Reminder: As per policy, all members are welcome to sit in on any event at Hacker Dojo.
As a courtesy, the Event RSVP system was built such that event hosts won't be surprised by the number of members attending their event. Members can RSVP up to 48 hours before the event, after that the RSVP list is locked.
http://events.hackerdojo.com/event/%s-%s
Cheers,
Hacker Dojo Events Team
""" % (user.nickname(),user.email(),event.key().id(), slugify(event.name)))
def notify_owner_expiring(event):
pass
def notify_owner_expired(event):
pass