Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#22 Do no eval...

closed
nobody
None
5
2010-08-28
2010-08-09
No

Patch to try to get rid of the evil `eval()` in the main application. I didn't look at the plugins. In the main application they where really unnecessary.

One `eval()` was in `drpython.drObject` for a test if the object has a given attribute. That's what the builtin function `hasattr()` is meant for. Because it is almost easier to use `hasattr()` in the places where `drObject.VariableExists()` was called I replaced the calls there and in the DrScript documentation.

This leaves us with a class with just one deprecated method. So I deprecated the class itself too and replaced its only instanciation in the main program by a dynamicalle created class and instance for the shared attributes of the DrScript scripts.

While replacing the calls to `drObject.VariableExists()` I noticed that the DrScript examples `SetTerminalArgs.py` and `RunInTerminal.py` didn't work. The `-e` option doesn't work this way with ``rxvt``. But it does with ``xterm``. Which is also to be more likely available on a standard Linux installation. I replaced the invoked terminal of the example and cleaned up the code a little bit.

Discussion

  • thanks, put into trunk

     
    • status: open --> closed