Changed URL from a noun to a verb (newview->addview)...

...and stubbed a deleteview page. Removed completed timestamp support
from TODO.
This commit is contained in:
Gregory Shikhman 2009-06-27 01:35:38 +00:00
parent fcb76ffcdd
commit e4add7affd
5 changed files with 27 additions and 99 deletions

View File

@ -2,7 +2,6 @@
--add in support for line and bar graphs (6/22)
--finish the page for adding new views (6/22?-6/24)
--add page for deleting views (6/23)
--add filtering by date ranges (6/24)
-code documentation and cleanness (6/24)
--add proper logging support, everything is currently spewed to httpd's stdout

View File

@ -110,8 +110,12 @@ class RootController(BaseController):
conn.close()
return dict(views=views)
@expose(template="wesstats.templates.newview")
def newview(self):
@expose(template="wesstats.templates.addview")
def addview(self):
return dict()
@expose(template="wesstats.templates.deleteview")
def deleteview(self):
return dict()
@expose()

View File

@ -1,96 +0,0 @@
# -*- coding: utf-8 -*-
"""Main Controller"""
from tg import expose, flash, require, url, request, redirect
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from catwalk.tg2 import Catwalk
from repoze.what import predicates
from wesstats.lib.base import BaseController
from wesstats.model import DBSession, metadata
from wesstats.controllers.error import ErrorController
from wesstats import model
from wesstats.controllers.secure import SecureController
__all__ = ['RootController']
class RootController(BaseController):
"""
The root controller for the wesstats application.
All the other controllers and WSGI applications should be mounted on this
controller. For example::
panel = ControlPanelController()
another_app = AnotherWSGIApplication()
Keep in mind that WSGI applications shouldn't be mounted directly: They
must be wrapped around with :class:`tg.controllers.WSGIAppController`.
"""
secc = SecureController()
admin = Catwalk(model, DBSession)
error = ErrorController()
@expose('wesstats.templates.index')
def index(self):
"""Handle the front-page."""
return dict(page='index')
@expose('wesstats.templates.about')
def about(self):
"""Handle the 'about' page."""
return dict(page='about')
@expose('wesstats.templates.authentication')
def auth(self):
"""Display some information about auth* on this application."""
return dict(page='auth')
@expose('wesstats.templates.index')
@require(predicates.has_permission('manage', msg=l_('Only for managers')))
def manage_permission_only(self, **kw):
"""Illustrate how a page for managers only works."""
return dict(page='managers stuff')
@expose('wesstats.templates.index')
@require(predicates.is_user('editor', msg=l_('Only for the editor')))
def editor_user_only(self, **kw):
"""Illustrate how a page exclusive for the editor works."""
return dict(page='editor stuff')
@expose('wesstats.templates.login')
def login(self, came_from=url('/')):
"""Start the user login."""
login_counter = request.environ['repoze.who.logins']
if login_counter > 0:
flash(_('Wrong credentials'), 'warning')
return dict(page='login', login_counter=str(login_counter),
came_from=came_from)
@expose()
def post_login(self, came_from=url('/')):
"""
Redirect the user to the initially requested page on successful
authentication or redirect her back to the login page if login failed.
"""
if not request.identity:
login_counter = request.environ['repoze.who.logins'] + 1
redirect(url('/login', came_from=came_from, __logins=login_counter))
userid = request.identity['repoze.who.userid']
flash(_('Welcome back, %s!') % userid)
redirect(came_from)
@expose()
def post_logout(self, came_from=url('/')):
"""
Redirect the user to the initially requested page on logout and say
goodbye as well.
"""
flash(_('We hope to see you soon!'))
redirect(came_from)

View File

@ -0,0 +1,21 @@
<!-- $Id$ -->
<!--
Copyright (C) 2009 by Gregory Shikhman <cornmander@cornmander.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
or at your option any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:py="http://genshi.edgewall.org/" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Delete a View</title>
</head>
<body>
</body>
</html>