params.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """
4 usage: %(progname)s [args]
5 """
6 
7 import nstart
8 
9 import os, sys, string, time, getopt, re
10 from pyclearsilver.log import *
11 
12 import neo_cgi, neo_util, neo_cs
13 
14 from pyclearsilver import CSPage
15 from pyclearsilver import odb
16 
17 import MBPage
18 import db_webui
19 
20 import roslib
21 import roslib.scriptutil
22 
23 import webutil
24 
25 from roslib.names import ns_join, get_ros_namespace, make_caller_id, make_global_ns, GLOBALNS
26 
27 
29  return make_caller_id('rosparam-%s'%os.getpid())
30 
32  def setup(self, hdf):
33  self.master = roslib.scriptutil.get_master()
34 
35  def display(self, hdf):
36  webutil.grabTopics(hdf, [])
37  webutil.set_tabs(hdf, ["status", "params"])
38 
39  _c, _t, params = self.master.getParam(_get_caller_id(), "/")
40  self.flatten(hdf, params, path="CGI.cur.params.")
41 
42  def flatten(self, hdf, params, path=""):
43  for k,v in params.items():
44  _path=path + k
45  if type(v) == type({}):
46  self.flatten(hdf, v, _path + ".")
47  else:
48  hdf.setValue(_path, str(v)[:128])
49 
50 
51  def Action_Edit(self, hdf):
52  key = hdf.getValue("Query.element_id", "")
53  value = hdf.getValue("Query.update_value", "")
54  delete = hdf.getValue("Query.delete", "")
55  hdf.setValue("CGI.result", hdf.getValue("Query.original_html", "ERROR"))
56 
57  if delete == "1":
58  results = self.master.deleteParam(_get_caller_id(), key)
59  if results[0] == 1:
60  hdf.setValue("CGI.result", "OK")
61  else:
62  hdf.setValue("CGI.result", "")
63  elif key != "" and value != "":
64  results = self.master.setParam(_get_caller_id(), key, value)
65  if results[0] == 1:
66  hdf.setValue("CGI.result", value)
67 
68  hdf.setValue("Content", "ajax_result.cs")
69 
70  def Action_New(self, hdf):
71  key = hdf.getValue("Query.key", "")
72  value = hdf.getValue("Query.value", "")
73 
74  if key != "" and value != "":
75  results = self.master.setParam(_get_caller_id(), key, value)
76  if results[0] == 1:
77  hdf.setValue("CGI.result", value)
78  self.redirectUri("params.py")
79 
80 
81 def run(context):
82  return MyPage(context, pagename="params", nologin=False)
83 
84 def main():
85  context = CSPage.Context()
86  run(context).start()
87 
88 if __name__ == "__main__":
89  main()
def redirectUri(self, redirectTo)
def flatten(self, hdf, params, path="")
Definition: params.py:42


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