|
Hi Bernd, I would recommend against calling ExecuteFile on each request,
as that would cause the code to be parsed and compiled every time (very
inefficient). Instead, one thing you can do is: -
On the first request, create an EngineModule -
Call ExecuteFile, passing your module -
Find methods that you care about in EngineModule.Globals -
Then on every request, you can call those methods, passing it
arguments that are specific to the current request (e.g. the HttpContext) You can also look at CreateLambda and CreateMethod, which may
make more sense depending on your specific scenario (i.e. what kind of code you
are executing). David From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Bernd Rössl Hello list,
Great to see
1.0 prod. Is out :) Anyway,
currently i'm embedding ironpython to a web application. This gives us the
ability to write extension and modules in python. One requirement is the
possibility to pass arguments from the user context to the python enviroment.
Till now i've done this by adding or setting object to the globals.
Unfortunetly this approach isn't multi user suitable since the python
enviroment is static and the same instance for all users respectivly for all
sessions. So it could happen that a passed value of session2 overrides the
passed value of session1. My thoughts:
1. Each
session has it's own python enviroment: this results in higher memory usage and
needs time each time a session loads it's python enviroment 2. The
arguments are not passed directly to the enviroment but to a session dependent
object: each script has to take care what args of what session will be taken 3. ? Is
there a possibility to pass args to a "ExecuteFile" context? I mean
my hosting application call's the method "executeFile" each time a
script will be executed and the passed args should be reachable ONLY in this
execution. What is the
best solution to handle this challenge? Thanks for
your hint's! Regards,
bernd |
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
