hi,
i have some scripts that load a bunch of files and do various smart things to
make it easy to work with my data. in particular, they define functions and
use cmd.extend() to register those functions. the setup takes a long time, and
is therefore inconvenient. i'd like to go through it once and save a session
file for the future.
i understand that saving commands created by cmd.extend() is a serious security
hole. is it serious enough that it's unacceptable even if the user turns the
security features off (i.e. "set security,0" or "pymol -o foo.pse")?
for what it's worth, my version of cmd.py now has this right before
"def extend..."
_extended_commands = {}
def session_save_extended_commands(session):
session['extended_commands'] = {}
for name,function in _extended_commands.iteritems():
print "SAVING FUNCTION:",name
session['extended_commands'][name] = function
def session_restore_extended_commands(session):
if 'extended_commands' in session:
for name,function in session['extended_commands'].iteritems():
if pymol.invocation.options.security:
print "NOT RESTORING FUNCTION",name,"FOR SECURITY REASONS"
else:
print "RESTORING FUNCTION:",name
extend(name,function)
return 1
if session_save_extended_commands not in pymol._session_save_tasks:
pymol._session_save_tasks.append(session_save_extended_commands)
if session_restore_extended_commands not in pymol._session_restore_tasks:
pymol._session_restore_tasks.append(session_restore_extended_commands)
and this at the end of the definition of extend:
_extended_commands[name] = function
it happens that i don't really use cmd.alias() so much, but the same thing
should work for saving aliased commands.
thanks,
-michael
--
www.umich.edu/~mlerner | _ |Michael Lerner
This isn't a democracy;| ASCII ribbon campaign ( ) | Michigan
it's a cheer-ocracy. | - against HTML email X | Biophysics
-Torrence, Bring It On| / \ | mler...@umich