Commit ceab009e authored by Evan Simpson's avatar Evan Simpson

Allow Add without Edit

parent 51efb515
...@@ -89,7 +89,7 @@ This product provides support for Script objects containing restricted ...@@ -89,7 +89,7 @@ This product provides support for Script objects containing restricted
Python code. Python code.
""" """
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import sys, os, traceback, re import sys, os, traceback, re
from Globals import MessageDialog, HTMLFile, package_home from Globals import MessageDialog, HTMLFile, package_home
...@@ -116,13 +116,17 @@ def manage_addPythonScript(self, id, REQUEST=None): ...@@ -116,13 +116,17 @@ def manage_addPythonScript(self, id, REQUEST=None):
id = str(id) id = str(id)
id = self._setObject(id, PythonScript(id)) id = self._setObject(id, PythonScript(id))
if REQUEST is not None: if REQUEST is not None:
file = REQUEST.form.get('file', None) file = REQUEST.form.get('file', '')
if type(file) is not type(''): file = file.read()
if file: if file:
if type(file) is not type(''): file = file.read()
self._getOb(id).write(file) self._getOb(id).write(file)
try: u = self.DestinationURL() try: u = self.DestinationURL()
except: u = REQUEST['URL1'] except: u = REQUEST['URL1']
REQUEST.RESPONSE.redirect('%s/%s/manage_main' % (u, quote(id))) if REQUEST['addedit'] == 'Add':
goto = '%s/manage_workspace' % u
else:
goto = '%s/%s/manage_main' % (u, quote(id))
REQUEST.RESPONSE.redirect(goto)
return '' return ''
......
...@@ -24,6 +24,7 @@ the script from a local file by typing the file name or using the ...@@ -24,6 +24,7 @@ the script from a local file by typing the file name or using the
<strong>File:</strong> <input type="file" name="file" size="25"> <strong>File:</strong> <input type="file" name="file" size="25">
</p> </p>
<p> <p>
<input type="submit" value="Add" name="addedit">
<input type="submit" value="Add and Edit" name="addedit"> <input type="submit" value="Add and Edit" name="addedit">
<input type="submit" value="Cancel" name="manage_workspace:method"> <input type="submit" value="Cancel" name="manage_workspace:method">
</p> </p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment