Go to the documentation of this file.00001
00002
00003 """
00004 usage: %(progname)s username
00005 add [taskids...]
00006 list
00007 del [taskids...]
00008 """
00009
00010 import roslib; roslib.load_manifest('webui')
00011
00012 import os, sys, string, time, getopt
00013 import urllib
00014
00015 from auth import db_auth
00016 import config
00017
00018 def test():
00019 pass
00020
00021 def usage(progname):
00022 print __doc__ % vars()
00023
00024 def main(argv, stdout, environ):
00025 progname = argv[0]
00026 optlist, args = getopt.getopt(argv[1:], "", ["help"])
00027
00028 testflag = 0
00029 if len(args) < 2:
00030 usage(progname)
00031 return
00032 for (field, val) in optlist:
00033 if field == "--help":
00034 usage(progname)
00035 return
00036 db = db_auth.initSchema()
00037
00038 username = args[0]
00039 cmd = args[1]
00040
00041
00042 user = db.users.lookup(username=username)
00043 if cmd == "add":
00044 for taskid in args[1:]:
00045 user.add_favorite_app(taskid)
00046 elif cmd == "list":
00047 for app in user.favorite_apps_list():
00048 print app
00049 elif cmd == "del":
00050 for taskid in args[1:]:
00051 user.remove_favorite_app(taskid)
00052
00053
00054
00055 if __name__ == "__main__":
00056 main(sys.argv, sys.stdout, os.environ)