Opened 8 years ago

Last modified 4 years ago

#3951 new enhancement

create cache directory

Reported by: ThurnerRupert Owned by: rjollos
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 cboos

  • Owner changed from pkropf to cboos
  • Trac Release changed from 0.10 to 0.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 ThurnerRupert

i'd consider an option for this overkill.

comment:3 Changed 7 years ago by bobbysmith007

I vote for just creating the directory

comment:4 Changed 7 years ago by bobbysmith007

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 rjollos

#5409 closed as a duplicate.

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

comment:7 Changed 5 years ago by rjollos

  • Owner changed from cboos to rjollos
  • Priority changed from normal to high
  • Status changed from new to assigned

comment:8 Changed 4 years ago by rjollos

  • Priority changed from high to normal

comment:9 Changed 4 years ago by rjollos

  • Status changed from assigned to new

Add Comment

Modify Ticket

as new The owner will remain rjollos.

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

Note: See TracTickets for help on using tickets.