edituser.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 """
00004 usage: %(progname)s [args]
00005 """
00006 
00007 import nstart
00008 
00009 import os, sys, string, time, getopt, re
00010 from pyclearsilver.log import *
00011 
00012 import neo_cgi, neo_util, neo_cs
00013 
00014 from pyclearsilver import CSPage
00015 from pyclearsilver import odb
00016 
00017 import MBPage
00018 import db_webui
00019 
00020 import roslib
00021 import roslib.scriptutil
00022 #import rospy
00023 import webutil
00024 
00025 class MyPage(MBPage.MBPage):
00026   def setup(self, hdf):
00027     self.db = db_webui.initSchema()
00028     
00029   def display(self, hdf):
00030     webutil.set_tabs(hdf, ["admin", "users"])
00031     username = hdf.getValue("Query.username", "").strip()
00032     row = self.authdb.users.lookup(username=username)
00033     row.hdfExport("CGI.cur.user", hdf)
00034 
00035   def Action_SaveUser(self, hdf):
00036     # load params from request
00037     username = hdf.getValue("Query.username", "").strip()
00038     role = hdf.getValue("Query.role", "").strip()
00039       
00040     # save the new user record
00041     try:
00042       row = self.authdb.users.lookup(username=username)
00043       row.role = hdf.getValue("Query.role", "")
00044       row.save()
00045     except:
00046       hdf.setValue("CGI.cur.error_message.password", "There was an error when trying to save this user.")
00047     
00048     self.redirectUri("users.py")
00049     
00050 def run(context):
00051   return MyPage(context, pagename="edituser", nologin=False)
00052 
00053 def main():
00054   context = CSPage.Context()
00055   run(context).start()
00056 
00057 if __name__ == "__main__":
00058   main()


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:00