favorites.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """
4 usage: %(progname)s username
5  add [taskids...]
6  list
7  del [taskids...]
8 """
9 
10 import roslib; roslib.load_manifest('webui')
11 
12 import os, sys, string, time, getopt
13 import urllib
14 
15 from auth import db_auth
16 import config
17 
18 def test():
19  pass
20 
21 def usage(progname):
22  print __doc__ % vars()
23 
24 def main(argv, stdout, environ):
25  progname = argv[0]
26  optlist, args = getopt.getopt(argv[1:], "", ["help"])
27 
28  testflag = 0
29  if len(args) < 2:
30  usage(progname)
31  return
32  for (field, val) in optlist:
33  if field == "--help":
34  usage(progname)
35  return
36  db = db_auth.initSchema()
37 
38  username = args[0]
39  cmd = args[1]
40 
41 
42  user = db.users.lookup(username=username)
43  if cmd == "add":
44  for taskid in args[1:]:
45  user.add_favorite_app(taskid)
46  elif cmd == "list":
47  for app in user.favorite_apps_list():
48  print app
49  elif cmd == "del":
50  for taskid in args[1:]:
51  user.remove_favorite_app(taskid)
52 
53 
54 
55 if __name__ == "__main__":
56  main(sys.argv, sys.stdout, os.environ)
def main(argv, stdout, environ)
Definition: favorites.py:24
def usage(progname)
Definition: favorites.py:21


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24