Skip to content
This repository
Newer
Older
100755 524 lines (476 sloc) 23.845 kb
84143502 » billsaysthis
2010-06-22 multiline for details and notes fields
1 import cgi
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
2 from google.appengine.ext import webapp, db
3 from google.appengine.ext.webapp import util, template
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
4 from google.appengine.api import urlfetch, memcache, users, mail
5
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
6 from django.utils import simplejson
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
7 from django.template.defaultfilters import slugify
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
8 from icalendar import Calendar, Event as CalendarEvent
b4ea2928 » Brian Klug
2010-06-22 Handler to bug pending events
9 import logging, urllib, os
7bdb866a » Brian Klug
2010-06-22 Let all members staff events.
10 from pprint import pprint
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
11 from datetime import datetime, timedelta
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
12
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
13 from models import Event, Feedback, HDLog, ROOM_OPTIONS, PENDING_LIFETIME
c97598b2 » dustball
2011-02-01 Room Conflict Detection
14 from utils import username, human_username, set_cookie, local_today, is_phone_valid, UserRights, dojo
81a81e14 » progrium
2010-04-18 adding errors for form validation, full notifications, and minor edit…
15 from notices import *
77425924 » progrium
2010-04-17 start of maintaining form state on errors
16
9f06c39a » casey
2010-11-07 Added RSS for upcoming events.
17 import PyRSS2Gen
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
18 import re
77872234 » Stig Hackvan
2011-01-21 restored an inscrutible but necessary pytz tzinfo quirk to the start/…
19 import pytz
9f06c39a » casey
2010-11-07 Added RSS for upcoming events.
20
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
21 webapp.template.register_template_library('templatefilters')
22
9f06c39a » casey
2010-11-07 Added RSS for upcoming events.
23 def event_path(event):
24 return '/event/%s-%s' % (event.key().id(), slugify(event.name))
25
219203b1 » dustball
2010-09-09 Cache better
26 class DomainCacheCron(webapp.RequestHandler):
27 def post(self):
28 noop = dojo('/groups/events',force=True)
29
30
f49797ae » dustball
2010-09-09 Reminders 2.0
31 class ReminderCron(webapp.RequestHandler):
32 def post(self):
33 self.response.out.write("REMINDERS")
34 today = local_today()
35 # remind everyone 3 days in advance they need to show up
36 events = Event.all() \
37 .filter('status IN', ['approved']) \
38 .filter('reminded =', False) \
39 .filter('start_time <', today + timedelta(days=3))
40 for event in events:
41 self.response.out.write(event.name)
42 # only mail them if they created the event 2+ days ago
43 if event.created < today - timedelta(days=2):
44 schedule_reminder_email(event)
45 event.reminded = True
46 event.put()
47
48
e2b9558e » btubbs
2010-05-01 Fixes issue 4. Changed to jqueryUI datepicker. Replaced jquery
49 class ExpireCron(webapp.RequestHandler):
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
50 def post(self):
51 # Expire events marked to expire today
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
52 today = local_today()
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
53 events = Event.all() \
54 .filter('status IN', ['pending', 'understaffed']) \
55 .filter('expired >=', today) \
56 .filter('expired <', today + timedelta(days=1))
57 for event in events:
58 event.expire()
59 notify_owner_expired(event)
f49797ae » dustball
2010-09-09 Reminders 2.0
60
f1997e40 » christopherb
2010-06-24 Made misc style fixes
61
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
62 class ExpireReminderCron(webapp.RequestHandler):
63 def post(self):
64 # Find events expiring in 10 days to warn owner
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
65 ten_days = local_today() + timedelta(days=10)
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
66 events = Event.all() \
67 .filter('status IN', ['pending', 'understaffed']) \
68 .filter('expired >=', ten_days) \
69 .filter('expired <', ten_days + timedelta(days=1))
70 for event in events:
71 notify_owner_expiring(event)
72
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
73 class ExportHandler(webapp.RequestHandler):
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
74 def get(self, format):
9c331d0d » progrium
2011-02-12 refactoring the export handler a bit
75 content_type, body = getattr(self, 'export_%s' % format)()
76 self.response.headers['content-type'] = content_type
77 self.response.out.write(body)
78
79 def export_json(self):
80 events = Event.get_approved_list()
81 for k in self.request.GET:
82 if self.request.GET[k] and k in ['member']:
83 value = users.User(urllib.unquote(self.request.GET[k]))
84 else:
85 value = urllib.unquote(self.request.GET[k])
86 events = events.filter('%s =' % k, value)
87 events = map(lambda x: x.to_dict(summarize=True), events)
88 return 'application/json', simplejson.dumps(events)
89
90 def export_ics(self):
9f06c39a » casey
2010-11-07 Added RSS for upcoming events.
91 events = Event.all().filter('status IN', ['approved', 'canceled']).order('start_time')
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
92 url_base = 'http://' + self.request.headers.get('host', 'events.hackerdojo.com')
9c331d0d » progrium
2011-02-12 refactoring the export handler a bit
93 cal = Calendar()
94 for event in events:
95 iev = CalendarEvent()
96 iev.add('summary', event.name if event.status == 'approved' else event.name + ' (%s)' % event.status.upper())
97 # make verbose description with empty fields where information is missing
98 ev_desc = '__Status: %s\n__Member: %s\n__Type: %s\n__Estimated size: %s\n__Info URL: %s\n__Fee: %s\n__Contact: %s, %s\n__Rooms: %s\n\n__Details: %s\n\n__Notes: %s' % (
99 event.status,
100 event.owner(),
101 event.type,
102 event.estimated_size,
103 event.url,
104 event.fee,
105 event.contact_name,
106 event.contact_phone,
107 event.roomlist(),
108 event.details,
109 event.notes)
110 # then delete the empty fields with a regex
111 ev_desc = re.sub(re.compile(r'^__.*?:[ ,]*$\n*',re.M),'',ev_desc)
112 ev_desc = re.sub(re.compile(r'^__',re.M),'',ev_desc)
113 ev_url = url_base + event_path(event)
114 iev.add('description', ev_desc + '\n--\n' + ev_url)
115 iev.add('url', ev_url)
116 if event.start_time:
117 iev.add('dtstart', event.start_time.replace(tzinfo=pytz.timezone('US/Pacific')))
118 if event.end_time:
119 iev.add('dtend', event.end_time.replace(tzinfo=pytz.timezone('US/Pacific')))
120 cal.add_component(iev)
121 return 'text/calendar', cal.as_string()
122
123 def export_rss(self):
124 url_base = 'http://' + self.request.headers.get('host', 'events.hackerdojo.com')
125 events = Event.all().filter('status IN', ['approved', 'canceled']).order('start_time')
126 rss = PyRSS2Gen.RSS2(
127 title = "Hacker Dojo Events Feed",
128 link = url_base,
129 description = "Upcoming events at the Hacker Dojo in Mountain View, CA",
130 lastBuildDate = datetime.now(),
131 items = [PyRSS2Gen.RSSItem(
132 title = event.name,
133 link = url_base + event_path(event),
134 description = event.details,
135 guid = url_base + event_path(event),
136 pubDate = event.updated,
137 ) for event in events]
138 )
139 return 'application/xml', rss.to_xml()
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
140
f1997e40 » christopherb
2010-06-24 Made misc style fixes
141
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
142 class EditHandler(webapp.RequestHandler):
143 def get(self, id):
144 event = Event.get_by_id(int(id))
145 user = users.get_current_user()
736390e1 » dustball
2010-12-10 Bug fixes & UI
146 show_all_nav = user
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
147 access_rights = UserRights(user, event)
148 if access_rights.can_edit:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
149 logout_url = users.create_logout_url('/')
150 rooms = ROOM_OPTIONS
151 hours = [1,2,3,4,5,6,7,8,9,10,11,12]
152 self.response.out.write(template.render('templates/edit.html', locals()))
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
153 else:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
154 self.response.out.write("Access denied")
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
155
156 def post(self, id):
157 event = Event.get_by_id(int(id))
158 user = users.get_current_user()
159 access_rights = UserRights(user, event)
160 if access_rights.can_edit:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
161 try:
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
162 start_time = datetime.strptime('%s %s:%s %s' % (
163 self.request.get('date'),
164 self.request.get('start_time_hour'),
165 self.request.get('start_time_minute'),
166 self.request.get('start_time_ampm')), '%m/%d/%Y %I:%M %p')
167 end_time = datetime.strptime('%s %s:%s %s' % (
168 self.request.get('date'),
169 self.request.get('end_time_hour'),
170 self.request.get('end_time_minute'),
171 self.request.get('end_time_ampm')), '%m/%d/%Y %I:%M %p')
20c252da » dustball
2011-02-09 Fix key/index bug
172 conflicts = Event.check_conflict(start_time,end_time,self.request.get_all('rooms'), int(id))
c97598b2 » dustball
2011-02-01 Room Conflict Detection
173 if conflicts:
174 raise ValueError('Room conflict detected')
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
175 if not self.request.get('estimated_size').isdigit():
176 raise ValueError('Estimated number of people must be a number')
177 if not int(self.request.get('estimated_size')) > 0:
178 raise ValueError('Estimated number of people must be greater then zero')
179 if ( self.request.get( 'contact_phone' ) and not is_phone_valid( self.request.get( 'contact_phone' ) ) ):
180 raise ValueError( 'Phone number does not appear to be valid' )
181 else:
b1936247 » jonathan
2011-02-27 much nicer event edit logs
182 log_desc = "Event edited<br />"
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
183 previous_object = Event.get_by_id(int(id))
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
184 event.name = self.request.get('name')
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
185 if (previous_object.name != event.name):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
186 log_desc = log_desc + "<strong>Title:</strong> " + previous_object.name + " to " + event.name + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
187 event.start_time = start_time
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
188 if (previous_object.start_time != event.start_time):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
189 log_desc = log_desc + "<strong>Start time:</strong> " + str(previous_object.start_time) + " to " + str(event.start_time) + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
190 event.end_time = end_time
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
191 if (previous_object.end_time != event.end_time):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
192 log_desc = log_desc + "<strong>End time:</strong> " + str(previous_object.end_time) + " to " + str(event.end_time) + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
193 event.estimated_size = cgi.escape(self.request.get('estimated_size'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
194 if (previous_object.estimated_size != event.estimated_size):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
195 log_desc = log_desc + "<strong>Est. size:</strong> " + previous_object.estimated_size + " to " + event.estimated_size + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
196 event.contact_name = cgi.escape(self.request.get('contact_name'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
197 if (previous_object.contact_name != event.contact_name):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
198 log_desc = log_desc + "<strong>Contact:</strong> " + previous_object.contact_name + " to " + event.contact_name + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
199 event.contact_phone = cgi.escape(self.request.get('contact_phone'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
200 if (previous_object.contact_phone != event.contact_phone):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
201 log_desc = log_desc + "<strong>Contact phone:</strong> " + previous_object.contact_phone + " to " + event.contact_phone + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
202 event.details = cgi.escape(self.request.get('details'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
203 if (previous_object.details != event.details):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
204 log_desc = log_desc + "<strong>Details:</strong> " + previous_object.details + " to " + event.details + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
205 event.url = cgi.escape(self.request.get('url'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
206 if (previous_object.url != event.url):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
207 log_desc = log_desc + "<strong>Url:</strong> " + previous_object.url + " to " + event.url + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
208 event.fee = cgi.escape(self.request.get('fee'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
209 if (previous_object.fee != event.fee):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
210 log_desc = log_desc + "<strong>Fee:</strong> " + previous_object.fee + " to " + event.fee + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
211 event.notes = cgi.escape(self.request.get('notes'))
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
212 if (previous_object.notes != event.notes):
a4f9ae70 » jonathan
2011-02-27 changed my mind about the italics
213 log_desc = log_desc + "<strong>Notes:</strong> " + previous_object.notes + " to " + event.notes + "<br />"
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
214 event.rooms = self.request.get_all('rooms')
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
215 if (previous_object.rooms != event.rooms):
b1936247 » jonathan
2011-02-27 much nicer event edit logs
216 log_desc = log_desc + "<strong>Rooms changed</strong>" + "<br />"
217 log_desc = log_desc + "<strong>Old room</strong>" + "<br />"
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
218 for room in previous_object.rooms:
219 log_desc = log_desc + room + ' '
b1936247 » jonathan
2011-02-27 much nicer event edit logs
220 log_desc = log_desc + "<br /><strong>New room(s)</strong><br />"
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
221 for room in event.rooms:
222 log_desc = log_desc + room + ' '
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
223 event.put()
8aa7c21a » jonathan
2011-02-27 patch edit screen.. changed datepicker formatting to be cohesive.. fi…
224 log = HDLog(event=event,description=log_desc)
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
225 log.put()
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
226 self.redirect(event_path(event))
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
227 except ValueError, e:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
228 error = str(e)
229 self.response.out.write(template.render('templates/error.html', locals()))
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
230 else:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
231 self.response.out.write("Access denied")
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
232
233
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
234 class EventHandler(webapp.RequestHandler):
235 def get(self, id):
236 event = Event.get_by_id(int(id))
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
237 if self.request.path.endswith('json'):
238 self.response.headers['content-type'] = 'application/json'
239 self.response.out.write(simplejson.dumps(event.to_dict()))
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
240 else:
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
241 user = users.get_current_user()
242 if user:
766e87c8 » christopherb
2010-06-26 Added UserRights class.
243 access_rights = UserRights(user, event)
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
244 logout_url = users.create_logout_url('/')
766e87c8 » christopherb
2010-06-26 Added UserRights class.
245
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
246 else:
247 login_url = users.create_login_url('/')
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
248 event.details = db.Text(event.details.replace('\n','<br/>'))
736390e1 » dustball
2010-12-10 Bug fixes & UI
249 show_all_nav = user
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
250 event.notes = db.Text(event.notes.replace('\n','<br/>'))
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
251 self.response.out.write(template.render('templates/event.html', locals()))
e2b9558e » btubbs
2010-05-01 Fixes issue 4. Changed to jqueryUI datepicker. Replaced jquery
252
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
253 def post(self, id):
254 event = Event.get_by_id(int(id))
255 user = users.get_current_user()
766e87c8 » christopherb
2010-06-26 Added UserRights class.
256 access_rights = UserRights(user, event)
257
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
258 state = self.request.get('state')
259 if state:
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
260 desc = ''
766e87c8 » christopherb
2010-06-26 Added UserRights class.
261 if state.lower() == 'approve' and access_rights.can_approve:
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
262 event.approve()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
263 desc = 'Approved event'
b84b5330 » dustball
2010-08-17 Fix one more staff logic bomb
264 if state.lower() == 'staff' and access_rights.can_staff:
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
265 event.add_staff(user)
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
266 desc = 'Added self as staff'
766e87c8 » christopherb
2010-06-26 Added UserRights class.
267 if state.lower() == 'unstaff' and access_rights.can_unstaff:
72849c29 » billsaysthis
2010-06-22 added unstaff event, including email notification if event becomes un…
268 event.remove_staff(user)
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
269 desc = 'Removed self as staff'
f8ffd897 » billsaysthis
2011-01-16 refactor lists to use singe event partial, adds contact email link in…
270 if state.lower() == 'onhold' and access_rights.can_cancel:
271 event.on_hold()
272 desc = 'Put event on hold'
766e87c8 » christopherb
2010-06-26 Added UserRights class.
273 if state.lower() == 'cancel' and access_rights.can_cancel:
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
274 event.cancel()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
275 desc = 'Cancelled event'
766e87c8 » christopherb
2010-06-26 Added UserRights class.
276 if state.lower() == 'delete' and access_rights.is_admin:
a67ac50e » mdhancher
2010-05-12 Add a simple admin-only event delete and undelete.
277 event.delete()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
278 desc = 'Deleted event'
766e87c8 » christopherb
2010-06-26 Added UserRights class.
279 if state.lower() == 'undelete' and access_rights.is_admin:
a67ac50e » mdhancher
2010-05-12 Add a simple admin-only event delete and undelete.
280 event.undelete()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
281 desc = 'Undeleted event'
766e87c8 » christopherb
2010-06-26 Added UserRights class.
282 if state.lower() == 'expire' and access_rights.is_admin:
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
283 event.expire()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
284 desc = 'Expired event'
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
285 if event.status == 'approved':
286 notify_owner_approved(event)
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
287 if desc != '':
288 log = HDLog(event=event,description=desc)
289 log.put()
9f06c39a » casey
2010-11-07 Added RSS for upcoming events.
290 self.redirect(event_path(event))
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
291
f1997e40 » christopherb
2010-06-24 Made misc style fixes
292
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
293 class ApprovedHandler(webapp.RequestHandler):
294 def get(self):
295 user = users.get_current_user()
296 if user:
297 logout_url = users.create_logout_url('/')
298 else:
299 login_url = users.create_login_url('/')
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
300 today = local_today()
736390e1 » dustball
2010-12-10 Bug fixes & UI
301 show_all_nav = user
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
302 events = Event.get_approved_list()
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
303 tomorrow = today + timedelta(days=1)
d63161ad » Brian Klug
2010-06-08 Add widget mode
304 whichbase = 'base.html'
305 if self.request.get('base'):
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
306 whichbase = self.request.get('base') + '.html'
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
307 self.response.out.write(template.render('templates/approved.html', locals()))
308
f1997e40 » christopherb
2010-06-24 Made misc style fixes
309
a82b43e5 » billsaysthis
2010-04-01 add myevents, pastevents code, refined list display on event page
310 class MyEventsHandler(webapp.RequestHandler):
311 @util.login_required
312 def get(self):
313 user = users.get_current_user()
314 if user:
315 logout_url = users.create_logout_url('/')
316 else:
317 login_url = users.create_login_url('/')
318 events = Event.all().filter('member = ', user).order('start_time')
736390e1 » dustball
2010-12-10 Bug fixes & UI
319 show_all_nav = user
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
320 today = local_today()
a82b43e5 » billsaysthis
2010-04-01 add myevents, pastevents code, refined list display on event page
321 tomorrow = today + timedelta(days=1)
322 self.response.out.write(template.render('templates/myevents.html', locals()))
323
f1997e40 » christopherb
2010-06-24 Made misc style fixes
324
a82b43e5 » billsaysthis
2010-04-01 add myevents, pastevents code, refined list display on event page
325 class PastHandler(webapp.RequestHandler):
326 def get(self):
327 user = users.get_current_user()
328 if user:
329 logout_url = users.create_logout_url('/')
330 else:
331 login_url = users.create_login_url('/')
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
332 today = local_today()
736390e1 » dustball
2010-12-10 Bug fixes & UI
333 show_all_nav = user
d75579f3 » progrium
2010-04-06 minor updates here and there to bills contributions.
334 events = Event.all().filter('start_time < ', today).order('-start_time')
a82b43e5 » billsaysthis
2010-04-01 add myevents, pastevents code, refined list display on event page
335 self.response.out.write(template.render('templates/past.html', locals()))
336
f1997e40 » christopherb
2010-06-24 Made misc style fixes
337
b4ea2928 » Brian Klug
2010-06-22 Handler to bug pending events
338 class CronBugOwnersHandler(webapp.RequestHandler):
339 def get(self):
340 events = Event.get_pending_list()
341 for e in events:
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
342 bug_owner_pending(e)
343
344
345 class AllFutureHandler(webapp.RequestHandler):
346 def get(self):
347 user = users.get_current_user()
348 if user:
349 logout_url = users.create_logout_url('/')
350 else:
351 login_url = users.create_login_url('/')
736390e1 » dustball
2010-12-10 Bug fixes & UI
352 show_all_nav = user
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
353 events = Event.get_all_future_list()
354 today = local_today()
355 tomorrow = today + timedelta(days=1)
356 self.response.out.write(template.render('templates/all_future.html', locals()))
b4ea2928 » Brian Klug
2010-06-22 Handler to bug pending events
357
f1997e40 » christopherb
2010-06-24 Made misc style fixes
358
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
359 class PendingHandler(webapp.RequestHandler):
360 def get(self):
361 user = users.get_current_user()
362 if user:
363 logout_url = users.create_logout_url('/')
364 else:
365 login_url = users.create_login_url('/')
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
366 events = Event.get_pending_list()
736390e1 » dustball
2010-12-10 Bug fixes & UI
367 show_all_nav = user
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
368 today = local_today()
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
369 tomorrow = today + timedelta(days=1)
370 self.response.out.write(template.render('templates/pending.html', locals()))
371
f1997e40 » christopherb
2010-06-24 Made misc style fixes
372
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
373 class NewHandler(webapp.RequestHandler):
fcf76029 » progrium
2010-03-21 working approval process and ical view of approved events
374 @util.login_required
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
375 def get(self):
376 user = users.get_current_user()
4d85afa1 » dustball
2010-09-09 Remove staffing requirement and make members more responsible
377 human = human_username(user)
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
378 if user:
379 logout_url = users.create_logout_url('/')
380 else:
381 login_url = users.create_login_url('/')
382 rooms = ROOM_OPTIONS
383 self.response.out.write(template.render('templates/new.html', locals()))
e2b9558e » btubbs
2010-05-01 Fixes issue 4. Changed to jqueryUI datepicker. Replaced jquery
384
f1997e40 » christopherb
2010-06-24 Made misc style fixes
385
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
386 def post(self):
387 user = users.get_current_user()
77425924 » progrium
2010-04-17 start of maintaining form state on errors
388 try:
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
389 start_time = datetime.strptime('%s %s:%s %s' % (
77425924 » progrium
2010-04-17 start of maintaining form state on errors
390 self.request.get('date'),
391 self.request.get('start_time_hour'),
392 self.request.get('start_time_minute'),
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
393 self.request.get('start_time_ampm')), '%m/%d/%Y %I:%M %p')
394 end_time = datetime.strptime('%s %s:%s %s' % (
77425924 » progrium
2010-04-17 start of maintaining form state on errors
395 self.request.get('date'),
396 self.request.get('end_time_hour'),
397 self.request.get('end_time_minute'),
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
398 self.request.get('end_time_ampm')), '%m/%d/%Y %I:%M %p')
c97598b2 » dustball
2011-02-01 Room Conflict Detection
399 conflicts = Event.check_conflict(start_time,end_time,self.request.get_all('rooms'))
400 if conflicts:
401 raise ValueError('Room conflict detected')
86158774 » Brian Klug
2010-06-14 Fix validation for event size
402 if not self.request.get('estimated_size').isdigit():
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
403 raise ValueError('Estimated number of people must be a number')
86158774 » Brian Klug
2010-06-14 Fix validation for event size
404 if not int(self.request.get('estimated_size')) > 0:
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
405 raise ValueError('Estimated number of people must be greater then zero')
77425924 » progrium
2010-04-17 start of maintaining form state on errors
406 if (end_time-start_time).days < 0:
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
407 raise ValueError('End time must be after start time')
a244c658 » dustball
2010-09-19 Bug fixes
408 if ( self.request.get( 'contact_phone' ) and not is_phone_valid( self.request.get( 'contact_phone' ) ) ):
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
409 raise ValueError( 'Phone number does not appear to be valid' )
77425924 » progrium
2010-04-17 start of maintaining form state on errors
410 else:
411 event = Event(
ca3c6ddc » Christopher Biettchert
2010-06-23 Escaped additional fields that could be used for XSS
412 name = cgi.escape(self.request.get('name')),
77425924 » progrium
2010-04-17 start of maintaining form state on errors
413 start_time = start_time,
414 end_time = end_time,
ca3c6ddc » Christopher Biettchert
2010-06-23 Escaped additional fields that could be used for XSS
415 type = cgi.escape(self.request.get('type')),
416 estimated_size = cgi.escape(self.request.get('estimated_size')),
417 contact_name = cgi.escape(self.request.get('contact_name')),
418 contact_phone = cgi.escape(self.request.get('contact_phone')),
84143502 » billsaysthis
2010-06-22 multiline for details and notes fields
419 details = cgi.escape(self.request.get('details')),
ca3c6ddc » Christopher Biettchert
2010-06-23 Escaped additional fields that could be used for XSS
420 url = cgi.escape(self.request.get('url')),
421 fee = cgi.escape(self.request.get('fee')),
84143502 » billsaysthis
2010-06-22 multiline for details and notes fields
422 notes = cgi.escape(self.request.get('notes')),
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
423 rooms = self.request.get_all('rooms'),
b8790635 » mdhancher
2010-05-13 Respect the local timezone (Pacific), and tidy up related imports.
424 expired = local_today() + timedelta(days=PENDING_LIFETIME), # Set expected expiration date
77425924 » progrium
2010-04-17 start of maintaining form state on errors
425 )
426 event.put()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
427 log = HDLog(event=event,description="Created new event")
428 log.put()
77425924 » progrium
2010-04-17 start of maintaining form state on errors
429 notify_owner_confirmation(event)
430 notify_new_event(event)
81a81e14 » progrium
2010-04-18 adding errors for form validation, full notifications, and minor edit…
431 set_cookie(self.response.headers, 'formvalues', None)
87868cf3 » jonathan
2011-02-28 issue 11 add a confirmation page
432 #self.redirect('/event/%s-%s' % (event.key().id(), slugify(event.name)))
433 self.redirect('/confirm/%s-%s' % (event.key().id(), slugify(event.name)))
434
81a81e14 » progrium
2010-04-18 adding errors for form validation, full notifications, and minor edit…
435 except Exception, e:
436 message = str(e)
437 if 'match format' in message:
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
438 message = 'Date is required.'
81a81e14 » progrium
2010-04-18 adding errors for form validation, full notifications, and minor edit…
439 if message.startswith('Property'):
440 message = message[9:].replace('_', ' ').capitalize()
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
441 # This is NOT a reliable way to handle erorrs
442 #set_cookie(self.response.headers, 'formerror', message)
443 #set_cookie(self.response.headers, 'formvalues', dict(self.request.POST))
444 #self.redirect('/new')
445 error = message
446 self.response.out.write(template.render('templates/error.html', locals()))
87868cf3 » jonathan
2011-02-28 issue 11 add a confirmation page
447
448 class ConfirmationHandler(webapp.RequestHandler):
449 def get(self, id):
450 event = Event.get_by_id(int(id))
451 self.response.out.write(template.render('templates/confirmation.html', locals()))
452
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
453 class LogsHandler(webapp.RequestHandler):
454 @util.login_required
455 def get(self):
456 user = users.get_current_user()
457 logs = HDLog.get_logs_list()
458 if user:
459 logout_url = users.create_logout_url('/')
460 else:
461 login_url = users.create_login_url('/')
736390e1 » dustball
2010-12-10 Bug fixes & UI
462 show_all_nav = user
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
463 self.response.out.write(template.render('templates/logs.html', locals()))
464
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
465 class FeedbackHandler(webapp.RequestHandler):
466 @util.login_required
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
467 def get(self, id):
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
468 user = users.get_current_user()
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
469 event = Event.get_by_id(int(id))
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
470 if user:
471 logout_url = users.create_logout_url('/')
472 else:
473 login_url = users.create_login_url('/')
474 self.response.out.write(template.render('templates/feedback.html', locals()))
475
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
476 def post(self, id):
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
477 user = users.get_current_user()
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
478 event = Event.get_by_id(int(id))
8c525221 » billsaysthis
2010-04-19 small tweak to how feedbacks displayed in event page
479 try:
480 if self.request.get('rating'):
481 feedback = Feedback(
482 event = event,
483 rating = int(self.request.get('rating')),
ca3c6ddc » Christopher Biettchert
2010-06-23 Escaped additional fields that could be used for XSS
484 comment = cgi.escape(self.request.get('comment')))
8c525221 » billsaysthis
2010-04-19 small tweak to how feedbacks displayed in event page
485 feedback.put()
0eb5a92c » billsaysthis
2010-12-04 basic logging for all user-initiated post methods in place
486 log = HDLog(event=event,description="Posted feedback")
487 log.put()
8c525221 » billsaysthis
2010-04-19 small tweak to how feedbacks displayed in event page
488 self.redirect('/event/%s-%s' % (event.key().id(), slugify(event.name)))
489 else:
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
490 raise ValueError('Please select a rating')
8c525221 » billsaysthis
2010-04-19 small tweak to how feedbacks displayed in event page
491 except Exception:
492 set_cookie(self.response.headers, 'formvalues', dict(self.request.POST))
7ebb2cdc » christopherb
2010-06-23 Cleaned up the style of the files some. Mostly standardizing on singl…
493 self.redirect('/feedback/new/' + id)
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
494
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
495 def main():
496 application = webapp.WSGIApplication([
497 ('/', ApprovedHandler),
4c7da5db » billsaysthis
2010-07-09 added func to ensure word 'in' only shown when rooms are assigned
498 ('/all_future', AllFutureHandler),
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
499 ('/pending', PendingHandler),
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
500 ('/past', PastHandler),
b4ea2928 » Brian Klug
2010-06-22 Handler to bug pending events
501 ('/cronbugowners', CronBugOwnersHandler),
a82b43e5 » billsaysthis
2010-04-01 add myevents, pastevents code, refined list display on event page
502 ('/myevents', MyEventsHandler),
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
503 ('/new', NewHandler),
87868cf3 » jonathan
2011-02-28 issue 11 add a confirmation page
504 ('/confirm/(\d+).*', ConfirmationHandler),
ca8c7f2d » dustball
2010-09-20 Let edit events and refactor error handling
505 ('/edit/(\d+).*', EditHandler),
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
506 # single event views
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
507 ('/event/(\d+).*', EventHandler),
2e08a66c » progrium
2010-06-22 cleaning things up and adding json representations for jon
508 ('/event/(\d+)\.json', EventHandler),
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
509 # various export methods -- events.{json,rss,ics}
510 ('/events\.(.+)', ExportHandler),
511 #
512 # CRON tasks
47a7f7aa » progrium
2010-04-04 basic form validation, added end time, start of notifications, some f…
513 ('/expire', ExpireCron),
34d98f07 » billsaysthis
2010-04-16 moved feedback stuff to separate py file, small tweak to email notifi…
514 ('/expiring', ExpireReminderCron),
219203b1 » dustball
2010-09-09 Cache better
515 ('/domaincache', DomainCacheCron),
f49797ae » dustball
2010-09-09 Reminders 2.0
516 ('/reminder', ReminderCron),
841fefb9 » Stig Hackvan
2011-01-21 added meaningful descriptions to ical events.
517 #
2ad290e3 » billsaysthis
2010-12-04 add logging model and obscure list view
518 ('/logs', LogsHandler),
d2c3dc75 » billsaysthis
2010-04-19 moved app-specific js to separate file
519 ('/feedback/new/(\d+).*', FeedbackHandler) ],debug=True)
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
520 util.run_wsgi_app(application)
521
f1997e40 » christopherb
2010-06-24 Made misc style fixes
522
9b632ddf » progrium
2010-03-06 initial commit -- basic form, rough listing
523 if __name__ == '__main__':
524 main()
Something went wrong with that request. Please try again.