Ticket #3951 (assigned enhancement)

Opened 5 years ago

Last modified 1 year ago

create cache directory

Reported by: ThurnerRupert Assigned to: rjollos (accepted)
Priority: high Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

a cache directory may be set to a temporary directory which will be cleaned from time to time. so it would be favourable if the cache directory will be recreated by the plugin instead of complaining about it as "missing".

Attachments

Change History

10/21/08 10:56:46 changed by cboos

  • release changed from 0.10 to 0.11.
  • owner changed from pkropf to cboos.

This is an use case I haven't thought about when closing #2157.

Do you think it's worth to add an option for that, like suggested in the above ticket, or should we just go ahead and create the folder if it's missing?

10/21/08 12:17:09 changed by ThurnerRupert

i'd consider an option for this overkill.

09/07/09 18:40:48 changed by bobbysmith007

I vote for just creating the directory

09/07/09 18:46:39 changed by bobbysmith007

I suggest something like the following which is working for us:

Index: graphviz/graphviz.py
===================================================================
--- graphviz/graphviz.py        (revision 6365)
+++ graphviz/graphviz.py        (working copy)
@@ -456,11 +456,11 @@
             self.cache_dir = os.path.join(self.env.path, self.cache_dir)

         if not os.path.exists(self.cache_dir):
-            if self.cache_dir_option == self.DEFAULT_CACHE_DIR:
-                os.mkdir(self.cache_dir)
-            else:
-                return _("The cache_dir '%(path)s' doesn't exist, "
-                         "please create it.", path=self.cache_dir)
+            #if self.cache_dir_option == self.DEFAULT_CACHE_DIR:
+            try:
+                os.makedirs(self.cache_dir)
+            except Exception, e:
+                return _("The cache_dir '%(path)s' doesn't exist, and we failed to create it please create it. :%(e)s", path=self.cache_dir, e=e)

         # Get optional configuration parameters from trac.ini.

01/23/12 09:23:04 changed by rjollos

#5409 closed as a duplicate.

02/06/12 06:02:30 changed by rjollos

I've just implemented this same feature for the TracPlantUmlPlugin ([11255]), in the way described by bobbysmith007 in comment:4. I'd like to go ahead and implement the same for this plugin. If no objection from the author / maintainer, or no response for two weeks in accordance with AdoptingHacks, I will proceed.

I added an option to specify the cache directory in [11255], but after reading the comments in this ticket, I agree that an option is overkill. I'd propose just creating the directory at $TRACENV/cache/graphviz.

02/10/12 04:33:28 changed by rjollos

  • status changed from new to assigned.
  • owner changed from cboos to rjollos.
  • priority changed from normal to high.

Add/Change #3951 (create cache directory)




Change Properties
Action