Modify

Opened 6 years ago

Closed 6 years ago

#2157 closed enhancement (fixed)

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

Reported by: TracContact@… Owned by: 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 (4)

graphviz.py (23.3 KB) - added by TracContact@… 6 years ago.
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@… 6 years ago.
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 6 years ago.
document the need for creating the cache_dir before hand
relative_cache_dir.patch (1.1 KB) - added by cboos 6 years ago.
[graphviz] cache_dir can be relative to the Trac environment path (must be applied after the previous patch)

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by TracContact@…

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

Changed 6 years ago by TracContact@…

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

comment:1 Changed 6 years ago by cboos

  • Trac 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.

Changed 6 years ago by cboos

document the need for creating the cache_dir before hand

Changed 6 years ago by cboos

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

comment:2 Changed 6 years ago 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.

comment:3 Changed 6 years ago by cboos

  • Resolution set to fixed
  • Status changed from new to closed

(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 Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from cboos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.