aboutsummaryrefslogtreecommitdiffstats
path: root/bin/common/srtool_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common/srtool_common.py')
-rwxr-xr-xbin/common/srtool_common.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/common/srtool_common.py b/bin/common/srtool_common.py
index f7e09764..46996aec 100755
--- a/bin/common/srtool_common.py
+++ b/bin/common/srtool_common.py
@@ -497,9 +497,21 @@ def gen_schema_header():
fd.write(" %s_%s = %d\n" % ('DATASOURCE','ONDEMAND' ,5))
fd.write(" %s_%s = %d\n" % ('DATASOURCE','ONSTARTUP' ,6))
fd.write(" %s_%s = '%s'\n" % ('DATASOURCE','FREQUENCY_STR', \
- 'Minute,Hourly,Daily,Weekly,Monthly,OnDemand.OnStartup' \
+ 'Minute,Hourly,Daily,Weekly,Monthly,OnDemand,OnStartup' \
))
+ fd.write("\n\n")
+ fd.write(" # General routine to return string name of a constant (e.g. 'DATASOURCE_FREQUENCY_STR')\n")
+ fd.write(" def get_orm_string(value,string_set):\n")
+ fd.write(" string_list = string_set.split(',')\n")
+ fd.write(" string_count = len(string_list)\n")
+ fd.write(" value = int(value)\n")
+ fd.write(" if (value < 0) or (value >= string_count):\n")
+ fd.write(" print(\"ERROR: value '%d' out of range of '%s'\" % (value,string_set))\n")
+ fd.write(" return '<error>'\n")
+ fd.write(" return string_list[value]\n")
+ fd.write("")
+
fd.write("\n")
#################################
@@ -538,7 +550,6 @@ def fix_cve_recommend():
i = 0
for cve in cur:
i += 1
- name_sort = get_name_sort(cve[ORM.CVE_NAME])
# Progress indicator support
if 0 == i % 10: