Ticket #2157 (closed enhancement: fixed)

Opened 1 year ago

Last modified 3 months ago

Option to create specified `cache_dir` if it does not exist

Reported by: TracContact@endoftheworldasweknowit.com Assigned to: cboos
Priority: normal Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

I think it would be nice if the macro code tried to created the cache_dir specified in trac.ini if it does not exists. To this end, I hacked on graphviz.py from http://trac-hacks.org/svn/graphvizplugin/0.9/ to add this feature. It is enabled by adding

create_cache_dir_if_needed = true

to the trac.ini file.

Attached is my version of graphviz.py and the diff file. I realize that what I did is rough and I'm sure does not follow many standards, so I submit it as a starting point for those who know more about this. However, it does work!

Attachments

graphviz.py (23.3 kB) - added by TracContact@endoftheworldasweknowit.com on 11/05/07 17:43:02.
Hacked version that will create specified cache_dir if it does not exist when create_cache_dir_if_needed = true is found in trac.ini file
graphviz_diff (1.2 kB) - added by TracContact@endoftheworldasweknowit.com on 11/05/07 17:45:17.
Diff between my version of graphviz.py and that found in http://trac-hacks.org/svn/graphvizplugin/0.9/
document_cache_dir.patch (1.7 kB) - added by cboos on 09/26/08 04:46:58.
document the need for creating the cache_dir before hand
relative_cache_dir.patch (1.1 kB) - added by cboos on 09/26/08 04:48:17.
[graphviz] cache_dir can be relative to the Trac environment path (must be applied after the previous patch)

Change History

11/05/07 17:43:02 changed by TracContact@endoftheworldasweknowit.com

  • attachment graphviz.py added.

Hacked version that will create specified cache_dir if it does not exist when create_cache_dir_if_needed = true is found in trac.ini file

11/05/07 17:45:17 changed by TracContact@endoftheworldasweknowit.com

  • attachment graphviz_diff added.

Diff between my version of graphviz.py and that found in http://trac-hacks.org/svn/graphvizplugin/0.9/

09/26/08 04:37:26 changed by cboos

  • release changed from 0.10 to 0.11.

Well, for me this little issue doesn't seem worth the trouble of an extra option.

When you install that plugin for the first time, chances are that you also will test it right away, then you'll notice that the cache directory must exist. Improving both the cache_dir documentation and the error message to mention this seems to be enough to me.

What would be more useful on this topic is to allow specifying a relative path for the cache_dir (path will be relative to the Trac environment), like we do now for most other stuff in Trac (like the repository_dir), the idea being that you could just move your self-contained Trac environment around. Patches follow.

09/26/08 04:46:58 changed by cboos

  • attachment document_cache_dir.patch added.

document the need for creating the cache_dir before hand

09/26/08 04:48:17 changed by cboos

  • attachment relative_cache_dir.patch added.

[graphviz] cache_dir can be relative to the Trac environment path (must be applied after the previous patch)

10/06/08 12:01:22 changed by cboos

  • owner changed from pkropf to cboos.

There's one more change related to this ticket to come: effectively creating the cache_dir folder when it doesn't exist, but only when that folder is the default relative one, in order to support "plug&play" installations.

10/06/08 12:37:25 changed by cboos

  • status changed from new to closed.
  • resolution set to fixed.

(In [4404]) GraphvizPlugin: in order to help "plug&play" installs, automatically create the cache_dir folder, but only if this corresponds to the default path.

If one sets explicitly a non-default cache_dir, one can as well make sure that this folder exists.

Closes #2157.


Add/Change #2157 (Option to create specified `cache_dir` if it does not exist)




Change Properties
Action