Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a44cfa0c
Commit
a44cfa0c
authored
Apr 11, 2001
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge to evan-script_fix-merge-3
parent
9ccb2125
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
9 deletions
+32
-9
lib/python/Products/PythonScripts/www/default.py
lib/python/Products/PythonScripts/www/default.py
+13
-0
lib/python/Products/PythonScripts/zbytecodehacks/VSExec.py
lib/python/Products/PythonScripts/zbytecodehacks/VSExec.py
+15
-8
lib/python/Products/PythonScripts/zbytecodehacks/code_editor.py
...thon/Products/PythonScripts/zbytecodehacks/code_editor.py
+2
-0
lib/python/Shared/DC/Scripts/Bindings.py
lib/python/Shared/DC/Scripts/Bindings.py
+2
-1
No files found.
lib/python/Products/PythonScripts/www/default.py
0 → 100644
View file @
a44cfa0c
# 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
(),
if
script
.
title
:
print
"(%s)"
%
html_quote
(
script
.
title
),
print
"in"
,
container
.
absolute_url
()
return
printed
lib/python/Products/PythonScripts/zbytecodehacks/VSExec.py
View file @
a44cfa0c
...
...
@@ -166,6 +166,15 @@ class CodeBlock:
self
.
munge_data
=
{}
self
.
munge
(
f
.
func_code
)
stack
=
[]
max_stack
=
0
for
op
in
f
.
func_code
.
co_code
.
opcodes
:
try
:
op
.
execute
(
stack
)
except
:
stack
=
[]
max_stack
=
max
(
max_stack
,
len
(
stack
))
if
max_stack
>
f
.
func_code
.
co_stacksize
:
f
.
func_code
.
set_stacksize
(
max_stack
)
if
not
self
.
errors
:
self
.
t
=
f
.
as_tuple
()
def
munge
(
self
,
fc
,
depth
=
0
):
...
...
@@ -198,7 +207,7 @@ class CodeBlock:
window
.
do_op
()
elif
op
and
forbid
.
get
(
op
.
op
,
0
):
errors
.
append
(
self
.
forbidden
%
(
opname
,
line
))
window
.
do_op
()
#
???
window
.
do_op
()
#
This is necessary to track stack usage.
else
:
for
m
in
mungers
:
handler
=
getattr
(
m
,
opname
,
None
)
...
...
@@ -217,6 +226,7 @@ class CodeBlock:
break
else
:
window
.
do_op
()
def
__call__
(
self
,
*
args
,
**
kargs
):
F
=
code_editor
.
Function
(
self
.
t
)
F
.
func_globals
=
self
.
globals
...
...
@@ -417,13 +427,10 @@ def GuardedBinaryOps(guards):
def
_wrap
(
w
):
load_guard
=
((
ops
.
LOAD_FAST
,),
((
guard
,),))
# Load the guard function before the guarded object, call after.
w
.
insert_code
(
load_guard
,
w
.
before_code_for
(
spos
))
if
spos
==
0
:
w
.
set_code
(
0
,
cf1
)
else
:
iops
=
w
.
insert_code
(
cf1
,
w
.
after_code_for
(
spos
))
# Fix the execution stack.
if
w
.
use_stack
:
w
.
stack
[
spos
]
=
(
w
.
stack
[
spos
][
0
],
iops
[
0
])
iops1
=
w
.
insert_code
(
load_guard
,
w
.
before_code_for
(
spos
))
iops2
=
w
.
insert_code
(
cf1
,
w
.
after_code_for
(
spos
))
# Fix the execution stack.
if
w
.
use_stack
:
w
.
stack
[
spos
]
=
(
iops1
[
0
],
iops2
[
0
])
def
_WriteGuardWrapper
():
def
model_handler
(
self
,
*
args
):
...
...
lib/python/Products/PythonScripts/zbytecodehacks/code_editor.py
View file @
a44cfa0c
...
...
@@ -252,6 +252,8 @@ class EditableCodeWorker:
self
.
co_name
=
name
def
set_filename
(
self
,
filename
):
self
.
co_filename
=
filename
def
set_stacksize
(
self
,
stacksize
):
self
.
co_stacksize
=
stacksize
def
as_tuple
(
self
):
# the assembling might change co_names or co_varnames - so
# make sure it's done *before* we start gathering them.
...
...
lib/python/Shared/DC/Scripts/Bindings.py
View file @
a44cfa0c
...
...
@@ -329,7 +329,8 @@ class Bindings:
# Try to find unbound parameters in the namespace, if the
# namespace is bound.
if
self
.
getBindingAssignments
().
isNameAssigned
(
'name_ns'
):
for
name
in
self
.
func_code
.
co_varnames
:
code
=
self
.
func_code
for
name
in
code
.
co_varnames
[:
code
.
co_argcount
]:
try
:
namevals
[
name
]
=
namespace
[
name
]
except
KeyError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment