Changeset 16109


Ignore:
Timestamp:
09/08/13 20:08:56 (12 years ago)
Author:
Eric.Larour
Message:

CHG: fixed issue with organizer and databases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/organizer.py

    r16100 r16109  
    66from savevars import *
    77from model import model
     8from whichdb import whichdb
    89
    910class organizer(object):
     
    2829                self.repository    ='./'
    2930                self.prefix        ='model.'
    30                 self.extension        ='' #default extension of python to save models.
    3131                self.trunkprefix   =''
    3232                self.steps         =[]
     
    5555                self.requestedsteps=options.getfieldvalue('steps',[0])
    5656               
    57                 #Get extension
    58                 self.extension=options.getfieldvalue('extension','')
    59 
    6057                #Get trunk prefix (only if provided by user)
    6158                if options.exist('trunkprefix'):
     
    7269                s+="%s\n" % "   Repository: '%s'" % self.repository
    7370                s+="%s\n" % "   Prefix:     '%s'" % self.prefix
    74                 s+="%s\n" % "   Extension:     '%s'" % self.extension
    7571                if not self.steps:
    7672                        s+="%s\n" % "   no step"
     
    10197                if not isinstance(string,(str,unicode)):
    10298                        raise TypeError("argument provided is not a string")
    103                 path=os.path.join(self.repository,self.prefix+'.step#'+string+'.python'+self.extension)
     99                path=os.path.join(self.repository,self.prefix+'.step#'+string+'.python')
    104100
    105101                #figure out if the model is there, otherwise, we have to use the default path supplied by user.
    106                 if os.path.exists(path):
     102                if whichdb(path):
    107103                        md=loadmodel(path)
    108104                        return md
     
    110106                #If we are here, the model has not been found. Try trunk prefix if provided
    111107                if self.trunkprefix:
    112                         path2=os.path.join(self.repository,self.trunkprefix+string+self.extension)
     108                        path2=os.path.join(self.repository,self.trunkprefix+string)
    113109                        if not os.path.exists(path2):
    114110                                raise IOError("Could find neither '%s' nor '%s'" % (path,path2))
Note: See TracChangeset for help on using the changeset viewer.