Modify

Opened 12 years ago

Closed 4 months ago

Last modified 4 months ago

#3951 closed enhancement (fixed)

create cache directory

Reported by: rupert thurner Owned by:
Priority: normal 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 (0)

Change History (12)

comment:1 Changed 12 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 12 years ago by rupert thurner

i'd consider an option for this overkill.

comment:3 Changed 11 years ago by Russ Tyndall

I vote for just creating the directory

comment:4 Changed 11 years ago by Russ Tyndall

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

  • graphviz/graphviz.py

     
    456456            self.cache_dir = os.path.join(self.env.path, self.cache_dir)
    457457
    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)
    464464
    465465        # Get optional configuration parameters from trac.ini.
    466466

comment:5 Changed 9 years ago by Ryan J Ollos

#5409 closed as a duplicate.

comment:6 Changed 9 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 9 years ago by Ryan J Ollos

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

comment:8 Changed 7 years ago by Ryan J Ollos

Priority: highnormal

comment:9 Changed 7 years ago by Ryan J Ollos

Status: assignednew

comment:10 Changed 5 months ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

comment:11 Changed 4 months ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Cache directory is created for recent releases. In latest, $env/files/gvcache is created.

comment:12 Changed 4 months ago by Ryan J Ollos

In 17773:

TracGraphviz 1.4.0.1: Create parents of cache dir

Refs #3951.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
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.