Ignore:
Timestamp:
Feb 23, 2009, 4:26:36 PM (16 years ago)
Author:
Edward Z. Yang <edwardzyang@…>
Branches:
master, debian, mac, no-cups, web
Children:
77aa4c8
Parents:
973dd91
git-author:
Edward Z. Yang <edwardzyang@…> (02/23/09 16:26:36)
git-committer:
Edward Z. Yang <edwardzyang@…> (02/23/09 16:26:36)
Message:

Remove scaffolding we don't know, implement volume output.

Signed-off-by: Edward Z. Yang <edwardzyang@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gutenbach-web/root.py

    r973dd91 r84ed773  
    1010from repoze.what import predicates
    1111from sipbmp3web.controllers.secure import SecureController
     12from remctl import remctl
    1213
    1314class RootController(BaseController):
     
    1718    @expose('sipbmp3web.templates.index')
    1819    def index(self):
    19         return dict(page='index')
     20        out = dict()
     21        out["volume"] = remctl("zsr", command=["v", "get"]).stdout
     22        return out
    2023
    2124    @expose('sipbmp3web.templates.about')
    2225    def about(self):
    23         return dict(page='about')
     26        return dict()
    2427
    25     @expose('sipbmp3web.templates.authentication')
    26     def auth(self):
    27         return dict(page='auth')
    28 
    29     @expose('sipbmp3web.templates.index')
    30     @require(predicates.has_permission('manage', msg=_('Only for managers')))
    31     def manage_permission_only(self, **kw):
    32         return dict(page='managers stuff')
    33 
    34     @expose('sipbmp3web.templates.index')
    35     @require(predicates.is_user('editor', msg=_('Only for the editor')))
    36     def editor_user_only(self, **kw):
    37         return dict(page='editor stuff')
    38 
    39     @expose('sipbmp3web.templates.login')
    40     def login(self, came_from=url('/')):
    41         login_counter = request.environ['repoze.who.logins']
    42         if login_counter > 0:
    43             flash(_('Wrong credentials'), 'warning')
    44         return dict(page='login', login_counter=str(login_counter),
    45                     came_from=came_from)
    46 
    47     @expose()
    48     def post_login(self, came_from=url('/')):
    49         if not request.identity:
    50             login_counter = request.environ['repoze.who.logins'] + 1
    51             redirect(url('/login', came_from=came_from, __logins=login_counter))
    52         userid = request.identity['repoze.who.userid']
    53         flash(_('Welcome back, %s!') % userid)
    54         redirect(came_from)
    55 
    56     @expose()
    57     def post_logout(self, came_from=url('/')):
    58         flash(_('We hope to see you soon!'))
    59         redirect(came_from)
Note: See TracChangeset for help on using the changeset viewer.