From e4add7affd3b32549abf3f11e4076ccba6b2a576 Mon Sep 17 00:00:00 2001 From: Gregory Shikhman Date: Sat, 27 Jun 2009 01:35:38 +0000 Subject: [PATCH] Changed URL from a noun to a verb (newview->addview)... ...and stubbed a deleteview page. Removed completed timestamp support from TODO. --- website/stats.wesnoth.org/TODO | 1 - .../wesstats/controllers/root.py | 8 +- .../wesstats/controllers/root.py.bak | 96 ------------------- .../templates/{newview.html => addview.html} | 0 .../wesstats/templates/deleteview.html | 21 ++++ 5 files changed, 27 insertions(+), 99 deletions(-) delete mode 100644 website/stats.wesnoth.org/wesstats/controllers/root.py.bak rename website/stats.wesnoth.org/wesstats/templates/{newview.html => addview.html} (100%) create mode 100644 website/stats.wesnoth.org/wesstats/templates/deleteview.html diff --git a/website/stats.wesnoth.org/TODO b/website/stats.wesnoth.org/TODO index 6714802870a..032040c5c10 100644 --- a/website/stats.wesnoth.org/TODO +++ b/website/stats.wesnoth.org/TODO @@ -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 diff --git a/website/stats.wesnoth.org/wesstats/controllers/root.py b/website/stats.wesnoth.org/wesstats/controllers/root.py index 5647ef02efd..cab47188363 100644 --- a/website/stats.wesnoth.org/wesstats/controllers/root.py +++ b/website/stats.wesnoth.org/wesstats/controllers/root.py @@ -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() diff --git a/website/stats.wesnoth.org/wesstats/controllers/root.py.bak b/website/stats.wesnoth.org/wesstats/controllers/root.py.bak deleted file mode 100644 index 16afd197f45..00000000000 --- a/website/stats.wesnoth.org/wesstats/controllers/root.py.bak +++ /dev/null @@ -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) diff --git a/website/stats.wesnoth.org/wesstats/templates/newview.html b/website/stats.wesnoth.org/wesstats/templates/addview.html similarity index 100% rename from website/stats.wesnoth.org/wesstats/templates/newview.html rename to website/stats.wesnoth.org/wesstats/templates/addview.html diff --git a/website/stats.wesnoth.org/wesstats/templates/deleteview.html b/website/stats.wesnoth.org/wesstats/templates/deleteview.html new file mode 100644 index 00000000000..9efd1e8bb60 --- /dev/null +++ b/website/stats.wesnoth.org/wesstats/templates/deleteview.html @@ -0,0 +1,21 @@ + + + + + +Delete a View + + + +