Hi,

Andreas Granig wrote:
Hi,

Stefan Sayer wrote:
One problem is though, how to prevent this evaluation from happening - if you really want to have the string "3+4" in the variable - with your patch, you can't (with the 'set' function at least). so I am wondering whether it is not better to add some eval() function. Also, there is

Wouldn't it probably be a good idea to quote strings anyways in all functions? That way, we could always evaluate all non-quoted parameters and treat quoted ones as strings? This would be consistent to other kind of programming languages also.
yes, that syntax makes sense.


some (minor) performance penalty involved when you need to search all strings for '+' or '-' in every "set".

You're right, but is this really an issue here? Because I'd even go a
hm, we've got that motto: 'E stands for Express'...

if we implement the mandatory quoting for strings like you mentioned above, I think it's ok - the evaluation happens only on those parameters that are meant to be evaluated.

for the moment though, I think I will change back set() to eval_ops=false and add another eval() action, which has eval_ops=true.

step further and evaluate *every* string being passed to a function. At
yes, this would indeed be nice. my idea was add something similar to the evaluation of variables which is done in mod_mysql now, where you can do mysql.execute(INSERT INTO mytable (username,pin) values ($username, $pin));


the moment,
    set($bar=something);
    log(2, foo=$bar);
will result in "foo=$bar" instead of "foo=something", as far as I've seen. What would be cool though is something like
    set($bar=something);
    log(2, "foo=" . $bar);
resulting in "foo=something".

Do you think this is worth the effort? I mean, a workaround is always
yes, I think so.

something like
    py(dsm.log("foo=%s" % session.var('bar')));
which is, performance-wise, not really too good.

It's just a matter of how far we want to push the syntax of DSMs.
I would try to keep a good balance between simplicity and functionality. for the more complex cases, one can always use a python function or quickly add another specialized action.


By the way, speaking of mod_py: it only seems to be possible to access local vars (the ones with $xxx) with session.var(...), but not selects. So to log the called user, I need to do
    set($my_us...@user);
    py(dsm.log("user=%s" % session.var('user')));
true; I have added a simple implementation as function:
 py(dsm.log(2, "user=%s" % session.select('user')));

Stefan

Or is there another function for that, which I just overlooked?

Andreas






--
Stefan Sayer
VoIP Services Consulting and Development

Warschauer Str. 24
10243 Berlin

tel:+491621366449
sip:[email protected]
email/xmpp:[email protected]


_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to