On Thu, 20 Oct 2005 06:38:31 +0000, spyce@... said:
> Thanks for the response Jonathan. However it appears as though w/ 2.x
> spyce .imports are evaluated before normal python imports. So doing this:
>
> [[import spyce]]
> [[cfg = spyce.getServer().config]]
>
> [[.import name=pool]]
> [[.import name=session args="'session_dir', cfg['session_dir'],
> auto=cfg['session_timeout']"]]
>
> results in an UnboundLocalError: local variable 'cfg' referenced before
> assignment.
For the same reason as before: you can't pass python code to .import
anymore. Period.
> So in order to use setHandler I would likely need to subclass session
> such that the session_dir and session_timeout parameters can accept
> variable data? From there, I would then do:
>
> [[.import name=session ]
> [[setHandler(mySession)]]
It's only in the .import itself that you can't use the variables. So
you can write
[[.import name=session]]
[[session.setHandler('session_dir', whatever)]]
without any subclassing.
-Jonathan
|