[IronPython] DLR Hosting Question
Michael Cummings
cummings.michael at gmail.com
Thu Mar 27 20:01:19 CET 2008
Hi all,
I'm putting together a seminar at our local Code Camp for hosting the DLR
and integration with applications. The hosting spec pdf is great however I
do have (at least) one question that isn't explained very well in the doc.
How can I restrict what assemblies can be loaded by a ScriptScope? To
explain further: If I use the following code to load a py script file
ScriptRuntime env = ScriptRuntime.Create();
ScriptEngine eng = env.GetEngineByFileExtension( "py" );
ScriptSource source = eng.CreateScriptSourceFromString(
form.Source, SourceCodeKind.File );
source.Execute();
Where form.Source is a string containing this :
import sys
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System")
clr.AddReference("Microsoft.Xna.Framework")
clr.AddReference("Microsoft.Xna.Framework.Graphics")
clr.AddReference("Microsoft.Xna.Framework.Input")
clr.AddReference("Bnoerj.AI.Steering.Demo.Plugins.Ctf")
from Bnoerj.AI.Steering.Demo.Plugins.Ctf import CtfBase, Globals
class CtfPythonSeeker(CtfBase):
def __init__(self):
Reset()
def Reset(self):
Globals.Instance.Seeker = self
How can I prevent some references from being referenced, like "
Microsoft.Xna.Framework" but allow "Bnoerj.AI.Steering.Demo.Plugins.Ctf"?
Thanks in advance
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080327/fd236c76/attachment.html>
More information about the Ironpython-users
mailing list