Changeset 84ed773 for gutenbach-web/root.py
- Timestamp:
- Feb 23, 2009, 4:26:36 PM (16 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gutenbach-web/root.py
r973dd91 r84ed773 10 10 from repoze.what import predicates 11 11 from sipbmp3web.controllers.secure import SecureController 12 from remctl import remctl 12 13 13 14 class RootController(BaseController): … … 17 18 @expose('sipbmp3web.templates.index') 18 19 def index(self): 19 return dict(page='index') 20 out = dict() 21 out["volume"] = remctl("zsr", command=["v", "get"]).stdout 22 return out 20 23 21 24 @expose('sipbmp3web.templates.about') 22 25 def about(self): 23 return dict( page='about')26 return dict() 24 27 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'] + 151 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.