Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handler to bug pending events

  • Loading branch information...
commit b4ea2928dd29be6b18c102c5fc0ef9efbae7a9ff 1 parent 7bdb866
Brian Klug authored
Showing with 51 additions and 1 deletion.
  1. +8 −1 main.py
  2. +43 −0 notices.py
View
9 main.py
@@ -5,7 +5,7 @@
from django.utils import simplejson
from django.template.defaultfilters import slugify
from icalendar import Calendar
-import logging, urllib
+import logging, urllib, os
from pprint import pprint
from datetime import datetime, timedelta
@@ -125,6 +125,12 @@ def get(self):
is_admin = username(user) in dojo('/groups/events')
self.response.out.write(template.render('templates/past.html', locals()))
+class CronBugOwnersHandler(webapp.RequestHandler):
+ def get(self):
+ events = Event.get_pending_list()
+ for e in events:
+ bug_owner_pending(e)
+
class PendingHandler(webapp.RequestHandler):
def get(self):
user = users.get_current_user()
@@ -236,6 +242,7 @@ def main():
('/events\.(.+)', EventsHandler),
('/past', PastHandler),
('/pending', PendingHandler),
+ ('/cronbugowners', CronBugOwnersHandler),
('/myevents', MyEventsHandler),
('/new', NewHandler),
('/event/(\d+).*', EventHandler),
View
43 notices.py
@@ -1,10 +1,53 @@
from google.appengine.api import mail
from django.template.defaultfilters import slugify
+import os
FROM_ADDRESS = "Dojo Events <no-reply@hackerdojo-events.appspotmail.com>"
NEW_EVENT_ADDRESS = "events@hackerdojo.com"
STAFF_ADDRESS = "staff@hackerdojo.com"
+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 e.staff_needed()>0:
+ body += """
+Alert! You still need to get %i more member(s) to staff your event.
+Please get some other Dojo members to go to
+http://%s/event/%s-%s and click the 'Staff' button.
+""" % (
+ e.staff_needed(),
+ 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 events@hackerdojo.com to see whats up.
+"""
+
+ body += """
+Your event is NOT scheduled. Please remedy the above issues to get your event official.
+"""
+
+ print body
+ print "*" * 80
+
+ mail.send_mail(sender=FROM_ADDRESS, to=e.member.email(),
+ subject="[Pending Event] Your event is still pending: " + e.name,
+ body=body)
+
def notify_owner_confirmation(event):
mail.send_mail(sender=FROM_ADDRESS, to=event.member.email(),
subject="[New Event] Submitted but **not yet approved**",
Please sign in to comment.
Something went wrong with that request. Please try again.