Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

basic logging for all user-initiated post methods in place

  • Loading branch information...
commit 0eb5a92c874f5b752b19351095c78c6ac11fb238 1 parent 2ad290e
@billsaysthis billsaysthis authored
View
18 main.py
@@ -158,9 +158,8 @@ def post(self, id):
event.notes = cgi.escape(self.request.get('notes'))
event.rooms = self.request.get_all('rooms')
event.put()
- log = HDLog(event=event,description="edited something")
+ log = HDLog(event=event,description="Edited event")
log.put()
- logging.info('%s %s %s' % (log.user.nickname, log.event.name, log.description))
self.redirect(event_path(event))
except ValueError, e:
error = str(e)
@@ -195,22 +194,33 @@ def post(self, id):
state = self.request.get('state')
if state:
+ desc = ''
if state.lower() == 'approve' and access_rights.can_approve:
event.approve()
+ desc = 'Approved event'
if state.lower() == 'staff' and access_rights.can_staff:
event.add_staff(user)
+ desc = 'Added self as staff'
if state.lower() == 'unstaff' and access_rights.can_unstaff:
event.remove_staff(user)
+ desc = 'Removed self as staff'
if state.lower() == 'cancel' and access_rights.can_cancel:
event.cancel()
+ desc = 'Cancelled event'
if state.lower() == 'delete' and access_rights.is_admin:
event.delete()
+ desc = 'Deleted event'
if state.lower() == 'undelete' and access_rights.is_admin:
event.undelete()
+ desc = 'Undeleted event'
if state.lower() == 'expire' and access_rights.is_admin:
event.expire()
+ desc = 'Expired event'
if event.status == 'approved':
notify_owner_approved(event)
+ if desc != '':
+ log = HDLog(event=event,description=desc)
+ log.put()
self.redirect(event_path(event))
@@ -345,6 +355,8 @@ def post(self):
expired = local_today() + timedelta(days=PENDING_LIFETIME), # Set expected expiration date
)
event.put()
+ log = HDLog(event=event,description="Created new event")
+ log.put()
notify_owner_confirmation(event)
notify_new_event(event)
set_cookie(self.response.headers, 'formvalues', None)
@@ -411,6 +423,8 @@ def post(self, id):
rating = int(self.request.get('rating')),
comment = cgi.escape(self.request.get('comment')))
feedback.put()
+ log = HDLog(event=event,description="Posted feedback")
+ log.put()
self.redirect('/event/%s-%s' % (event.key().id(), slugify(event.name)))
else:
raise ValueError('Please select a rating')
View
6 templates/logs.html
@@ -7,14 +7,14 @@
<table id='log-list'>
<tr>
- <th style='width:110px;'>Timestamp</th>
- <th style='width:220px;'>Member</th>
+ <th style='width:30%;'>Timestamp</th>
+ <th style='width:30%;'>Member</th>
<th>Event</th>
</tr>
{% for log in logs %}
<tr>
<td>{{log.created|date:"b j Y"|title}} {{log.created|date:"g:i A"|lower}}</td>
- <td>{{log.user.nickname}}</td>
+ <td><a href="mailto:{{log.user.nickname}}?subject={{log.event.name}}">{{log.user.nickname}}</a></td>
<td><a href="/event/{{log.event.key.id}}-{{log.event.name|slugify}}">{{log.event.name}}</a></td>
</tr>
<tr>
View
4 templates/myevents.html
@@ -1,8 +1,6 @@
{% extends 'base.html' %}
{% block content %}
-<div id="menu" style="float: right; margin: 10px; font-size: smaller;">
- <a href="/">Approved</a> | <a href="/pending">Pending</a> | <a href="/new" style="font-weight: bold;">New Event</a>
-</div>
+{% include 'nav_menu.html' %}
<div id="primary">
<h3>My Events</h3>
View
2  templates/nav_menu.html
@@ -1,3 +1,3 @@
<div id="menu">
- <strong>Filter:</strong> <a href="/" id="nav_approved">Approved</a> | <a href="/pending" id="nav_pending">Pending</a> {% if show_all_nav %}| <a href="/all_future" id="nav_all_future">All</a> {% endif %}
+ <strong>Filter Events:</strong> <a href="/" id="nav_approved">Approved</a> | <a href="/pending" id="nav_pending">Pending</a> {% if show_all_nav %}| <a href="/all_future" id="nav_all_future">All</a> {% endif %}
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.