Skip to content

Commit

Permalink
Add a function to recompile all Scripts that need it. It is invoked b…
Browse files Browse the repository at this point in the history
…y visiting /manage_addProducts/PythonScripts/recompile in a browser.
  • Loading branch information
Evan Simpson committed Dec 14, 2001
1 parent e1cb8e2 commit 935e5f0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#
##############################################################################
__doc__='''Python Scripts Product Initialization
$Id: __init__.py,v 1.8 2001/11/28 15:51:05 matt Exp $'''
__version__='$Revision: 1.8 $'[11:-2]
$Id: __init__.py,v 1.9 2001/12/14 18:59:28 evan Exp $'''
__version__='$Revision: 1.9 $'[11:-2]

import PythonScript
try:
Expand Down Expand Up @@ -41,3 +41,21 @@ def initialize(context):
context.registerHelp()
context.registerHelpTitle('Script (Python)')

# utility stuff

def recompile(self):
'''Recompile all Python Scripts'''
base = self.this()
scripts = base.ZopeFind(base, obj_metatypes=('Script (Python)',))
names = []
for name, ob in scripts:
if ob._v_change:
names.append(name)
ob._compile()
ob._p_changed = 1

if names:
return 'The following Scripts were recompiled:\n' + '\n'.join(names)
return 'No Scripts were found that required recompilation.'

_m = {'recompile': recompile}

0 comments on commit 935e5f0

Please sign in to comment.