Sat 05 Nov 2005 07:28:19 PM UTC, comment #2:
I had a look at this. Some relatively simple things that should be fixed:
1. It assembles shell commands as a string without doing proper quoting of e.g. filenames. Best is to avoid assembling a command as a single string completely and to always use a list of argv components. The popen functions in Python accept those too. Best would be to use the subprocess module from Python 2.4 (that would require raising the minimum python version I think)
2. If not explicitly selecting a file to write to, the plugin writes to a file called "temp.ps" in the current directory. This might overwrite existing files and it may not work sometimes since the current working directory might mot be writable. The plugin should use proper temporary files or pipe the output of poster directly to lpr, or somesuch.
3. the logic of deleting temp.ps looks wrong:
if outfile and outfile.name == "tmp.ps":
os.remove(outfile.name)
This could delete a file the user wanted to create explicitly. Keep a separate flag of whether there's a file that needs to be removed.
4. at least one typo: orrured instead of occurred.
5. This shouldn't be a PluginCompound plugin. It doesn't define a new object type. The only reason this isn't a problem yet is that Skencil 0.7 doesn't have a menu for plugin types yet.
For poster.py to be loaded automatically, Skencil needs a new plugin type, though.
|