Skip to content

Commit

Permalink
Adjust the default script to make it work for python3.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-hof committed Jul 16, 2017
1 parent c42c8d3 commit 1c17496
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Products/PythonScripts/PythonScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@
' of your server in a browser.')

manage_addPythonScriptForm = DTMLFile('www/pyScriptAdd', globals())
_default_file = os.path.join(package_home(globals()),
'www', 'default_py')

if six.PY3:
_default_file = os.path.join(package_home(globals()), 'www', 'default_py3')
else:
_default_file = os.path.join(package_home(globals()), 'www', 'default_py2')

_marker = [] # Create a new marker object

Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions src/Products/PythonScripts/www/default_py3
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Example code:

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
response = request.response

# Return a string identifying this script.
print ("This is the", script.meta_type, '"%s"' % script.getId(), end=' ')
if script.title:
print ("(%s)" % html_quote(script.title), end=' ')
print ("in", container.absolute_url())
return printed

0 comments on commit 1c17496

Please sign in to comment.