diff rgToolFactory.py @ 10:71f2ac0eee95

Updated tarball with some test material - still need code generated... Completed a round trip test via a local toolshed. Awsome
author ross lazarus ross.lazarus@gmail.com
date Sat, 02 Jun 2012 22:40:33 +1000
parents e09c76551bed
children d12728e33c3d
line wrap: on
line diff
--- a/rgToolFactory.py	Sat Jun 02 21:08:57 2012 +1000
+++ b/rgToolFactory.py	Sat Jun 02 22:40:33 2012 +1000
@@ -1,11 +1,13 @@
-# rgDynamicScriptWrapper.py
-# derived from
+# rgToolFactory.py
+# derived from 
 # rgBaseScriptWrapper.py
-# to run some user supplied code 
-# extremely dangerous
+# but designed to run arbitrary user supplied code 
+# extremely dangerous!!
 # trusted users only - private site only
-# a list in the xml is searched - only users in the list can run this tool.
-# 
+# a list in the xml is searched for users permitted to run this tool.
+# DO NOT install on a public or important site - local instance only
+# generated tools are fine as they just run normally and their user cannot do anything unusually insecure
+#
 # copyright ross lazarus (ross.lazarus@gmail.com) May 2012
 # 
 # all rights reserved
@@ -170,6 +172,15 @@
         self.makeXML()
         tdir = self.toolname
         os.mkdir(tdir)
+        if self.opts.input_tab: # we may have test data?
+            testdir = os.path.join(tdir,'test-data')
+            os.mkdir(testdir) # make tests directory
+            shutil.copyfile(self.opts.input_tab,os.path.join(testdir,'test1_in.tab'))
+            if self.opts.output_tab:
+                shutil.copyfile(self.opts.output_tab,os.path.join(testdir,'test1_out.tab'))
+            if self.opts.make_HTML:
+                shutil.copyfile(self.opts.output_html,os.path.join(testdir,'test1_out.html'))
+                shutil.copyfile(self.opts.tlog,os.path.join(testdir,'test1_out.log'))
         shutil.copyfile(self.xmlfile,os.path.join(tdir,self.xmlfile))
         shutil.copyfile(self.pyfile,os.path.join(tdir,'%s.py' % self.toolname))
         shutil.copyfile(self.sfile,os.path.join(tdir,self.sfile))