Commit 2cb1d1f1 authored by Evan Simpson's avatar Evan Simpson

Changed _setText to write, added read and write to ac_permissions

parent a6f62f4f
...@@ -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.1 $'[11:-2] __version__='$Revision: 1.2 $'[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
...@@ -142,9 +142,9 @@ class PythonScript(Script, Historical): ...@@ -142,9 +142,9 @@ class PythonScript(Script, Historical):
__ac_permissions__ = ( __ac_permissions__ = (
('View management screens', ('View management screens',
('ZPythonScriptHTML_editForm', 'ZPythonScript_changePrefs', ('ZPythonScriptHTML_editForm', 'ZPythonScript_changePrefs',
'manage_main', 'ZScriptHTML_tryForm')), 'manage_main', 'ZScriptHTML_tryForm', 'read')),
('Change Python Scripts', ('Change Python Scripts',
('ZPythonScript_edit', 'PUT', 'manage_FTPput', ('ZPythonScript_edit', 'PUT', 'manage_FTPput', 'write',
'ZPythonScript_setTitle', 'ZPythonScriptHTML_upload', 'ZPythonScript_setTitle', 'ZPythonScriptHTML_upload',
'ZPythonScriptHTML_uploadForm', 'manage_historyCopy', 'ZPythonScriptHTML_uploadForm', 'manage_historyCopy',
'manage_beforeHistoryCopy', 'manage_afterHistoryCopy')), 'manage_beforeHistoryCopy', 'manage_afterHistoryCopy')),
...@@ -189,7 +189,7 @@ class PythonScript(Script, Historical): ...@@ -189,7 +189,7 @@ class PythonScript(Script, Historical):
def ZPythonScriptHTML_upload(self, REQUEST, file=''): def ZPythonScriptHTML_upload(self, REQUEST, file=''):
"""Replace the body of the script with the text in file.""" """Replace the body of the script with the text in file."""
if type(file) is not type(''): file = file.read() if type(file) is not type(''): file = file.read()
self._setText(file) self.write(file)
message = 'Content changed.' message = 'Content changed.'
return self.ZPythonScriptHTML_editForm(self, REQUEST, return self.ZPythonScriptHTML_editForm(self, REQUEST,
manage_tabs_message=message) manage_tabs_message=message)
...@@ -328,13 +328,13 @@ class PythonScript(Script, Historical): ...@@ -328,13 +328,13 @@ class PythonScript(Script, Historical):
def PUT(self, REQUEST, RESPONSE): def PUT(self, REQUEST, RESPONSE):
""" Handle HTTP PUT requests """ """ Handle HTTP PUT requests """
self.dav__init(REQUEST, RESPONSE) self.dav__init(REQUEST, RESPONSE)
self._setText(REQUEST.get('BODY', '')) self.write(REQUEST.get('BODY', ''))
RESPONSE.setStatus(204) RESPONSE.setStatus(204)
return RESPONSE return RESPONSE
manage_FTPput = PUT manage_FTPput = PUT
def _setText(self, text): def write(self, text):
self._validateProxy() self._validateProxy()
mdata = self._metadata_map() mdata = self._metadata_map()
st = 0 st = 0
...@@ -375,7 +375,7 @@ class PythonScript(Script, Historical): ...@@ -375,7 +375,7 @@ class PythonScript(Script, Historical):
self._body = rstrip(body) self._body = rstrip(body)
self._makeFunction(1) self._makeFunction(1)
except: except:
LOG(self.meta_type, ERROR, '_setText failed', error=sys.exc_info()) LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info())
raise raise
def manage_FTPget(self): def manage_FTPget(self):
......
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