Skip to content

Commit

Permalink
FileUpload objects now eval false if filename is empty.
Browse files Browse the repository at this point in the history
Upload buttons on DTML, Py Scripts, Files, Images and PTs raise an error
if the file is not specified instead of clearing the source (Bug #144)
  • Loading branch information
caseman committed Apr 12, 2002
1 parent 6603fce commit 8e6e993
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PythonScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Python code.
"""

__version__='$Revision: 1.41 $'[11:-2]
__version__='$Revision: 1.42 $'[11:-2]

import sys, os, traceback, re, marshal
from Globals import DTMLFile, MessageDialog, package_home
Expand Down Expand Up @@ -153,7 +153,11 @@ def ZPythonScriptHTML_upload(self, REQUEST, file=''):
"""Replace the body of the script with the text in file."""
if self.wl_isLocked():
raise ResourceLockedError, "The script is locked via WebDAV."
if type(file) is not type(''): file = file.read()

if type(file) is not type(''):
if not file: raise ValueError, 'File not specified'
file = file.read()

self.write(file)
message = 'Saved changes.'
return self.ZPythonScriptHTML_editForm(self, REQUEST,
Expand Down

0 comments on commit 8e6e993

Please sign in to comment.