Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (72 sloc) 2.66 KB
## ----------------------------------------------------------------------------
# Lollysite is a website builder and blogging platform for Google App Engine.
#
# Copyright (c) 2009, 2010 Andrew Chilton <andy@chilts.org>.
#
# Homepage : http://www.chilts.org/project/lollysite/
# Ohloh : https://www.ohloh.net/p/lollysite/
# FreshMeat : http://freshmeat.net/projects/lollysite
# Source : http://gitorious.org/lollysite/
#
# This file is part of Lollysite.
#
# Lollysite is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Lollysite is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Lollysite. If not, see <http://www.gnu.org/licenses/>.
#
## ----------------------------------------------------------------------------
# import standard modules
# none
# Google specific modules
# none
# local modules
from models import Message
import webbase
## ----------------------------------------------------------------------------
# List
class List(webbase.WebBase):
def get(self):
messages = Message.all().order('-inserted')
vals = {
'messages' : messages,
}
self.template( 'message-list.html', vals, 'admin' );
# Delete
class Del(webbase.WebBase):
def get(self):
try:
if self.request.get('key'):
item = Message.get( self.request.get('key') )
vals = {
'item' : item,
}
self.template( 'message-del.html', vals, 'admin' );
else:
self.redirect('.')
except:
self.redirect('.')
def post(self):
try:
item = Message.get( self.request.get('key') ) if self.request.get('key') else None
if item is not None:
try:
item.delete()
self.redirect('.')
except:
vals = {
'item' : item,
'err' : 'There was an error when deleting this message, please try again'
}
self.template( 'message-del.html', vals, 'admin' );
except:
self.redirect('.')
## ----------------------------------------------------------------------------