Changeset 4b9d354 for gutenbach-web
- Timestamp:
- Feb 23, 2009, 11:34:15 PM (16 years ago)
- Branches:
- master, debian, mac, no-cups, web
- Children:
- 0b8c868
- Parents:
- 1998d46
- git-author:
- Edward Z. Yang <edwardzyang@…> (02/23/09 23:34:15)
- git-committer:
- Edward Z. Yang <edwardzyang@…> (02/23/09 23:34:15)
- Location:
- gutenbach-web
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gutenbach-web/index.html
r1998d46 r4b9d354 15 15 <div id="status"> 16 16 <p>The volume is <span class="volume">$volume</span></p> 17 <div py:replace="volume_form"></div> 17 18 </div> 18 19 <div class="clearingdiv" /> -
gutenbach-web/root.py
r1998d46 r4b9d354 1 1 """Main Controller""" 2 2 from sipbmp3web.lib.base import BaseController 3 from tg import expose, flash, require, url, request, redirect 3 from tg import expose, flash, require, url, request, redirect, validate 4 4 from pylons.i18n import ugettext as _ 5 5 #from tg import redirect, validate … … 11 11 from sipbmp3web.controllers.secure import SecureController 12 12 from remctl import remctl 13 import tw.forms as twf 14 15 volume_form = twf.TableForm('volume_form', action='volume', children=[ 16 twf.TextField('volume', validator=twf.validators.Int(not_empty=True,min=1,max=31)) 17 ]) 18 19 server = "zygorthian-space-raiders.mit.edu" 13 20 14 21 class RootController(BaseController): … … 17 24 18 25 @expose('sipbmp3web.templates.index') 19 def index(self ):26 def index(self, **kw): 20 27 out = dict(page="index") 21 out["volume"] = remctl("zygorthian-space-raiders.mit.edu", command=["v", "get"]).stdout 22 return out 28 volume = int(remctl(server, command=["volume", "get"]).stdout.rstrip()) 29 if not "volume" in kw: kw["volume"] = volume 30 return dict( 31 page="index", 32 volume=volume, 33 volume_form=volume_form(kw), 34 ) 35 36 @validate(form=volume_form, error_handler=index) 37 @expose() 38 def volume(self, **kw): 39 remctl(server, command=["volume", "set", kw["volume"]]) 40 redirect('index') 23 41 24 42 @expose('sipbmp3web.templates.about')
Note: See TracChangeset
for help on using the changeset viewer.