Modify

Opened 16 years ago

Closed 16 years ago

#2157 closed enhancement (fixed)

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

Reported by: TracContact@… Owned by: Christian Boos
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@… 16 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@… 16 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 Christian Boos 16 years ago.
document the need for creating the cache_dir before hand
relative_cache_dir.patch (1.1 KB) - added by Christian Boos 16 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 16 years ago by TracContact@…

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

Changed 16 years ago by TracContact@…

Attachment: graphviz_diff added

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

comment:1 Changed 16 years ago by Christian Boos

Trac Release: 0.100.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 16 years ago by Christian Boos

Attachment: document_cache_dir.patch added

document the need for creating the cache_dir before hand

Changed 16 years ago by Christian Boos

Attachment: relative_cache_dir.patch added

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

comment:2 Changed 16 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos

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 16 years ago by Christian Boos

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.