Opened 8 years ago

Last modified 4 years ago

#3951 new enhancement

create cache directory

Reported by: rupert thurner Owned by: Ryan J Ollos
Priority: normal Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


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 (0)

Change History (9)

comment:1 Changed 8 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos
Trac Release: 0.100.11

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?

comment:2 Changed 8 years ago by rupert thurner

i'd consider an option for this overkill.

comment:3 Changed 8 years ago by Russ Tyndall

I vote for just creating the directory

comment:4 Changed 8 years ago by Russ Tyndall

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

  • graphviz/

    456456            self.cache_dir = os.path.join(self.env.path, self.cache_dir)
    458458        if not os.path.exists(self.cache_dir):
    459             if self.cache_dir_option == self.DEFAULT_CACHE_DIR:
    460                 os.mkdir(self.cache_dir)
    461             else:
    462                 return _("The cache_dir '%(path)s' doesn't exist, "
    463                          "please create it.", path=self.cache_dir)
     459            #if self.cache_dir_option == self.DEFAULT_CACHE_DIR:
     460            try:
     461                os.makedirs(self.cache_dir)
     462            except Exception, e:
     463                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)
    465465        # Get optional configuration parameters from trac.ini.

comment:5 Changed 5 years ago by Ryan J Ollos

#5409 closed as a duplicate.

comment:6 Changed 5 years ago by Ryan J Ollos

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.

comment:7 Changed 5 years ago by Ryan J Ollos

Owner: changed from Christian Boos to Ryan J Ollos
Priority: normalhigh
Status: newassigned

comment:8 Changed 4 years ago by Ryan J Ollos

Priority: highnormal

comment:9 Changed 4 years ago by Ryan J Ollos

Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Ryan J Ollos.

Add Comment

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

Note: See TracTickets for help on using tickets.