parameters: (cls, snapshot, file_type='main', file_name='', file_range='', mkdir=True, protocol=None, ext='', parent=None, checkin_type='')
return_statement: return path
docstring: Get a preallocated directory for this snapshot.  This will run a
          virtual checkin through the naming convention and construct a path
          that Tactic expects the checked in file to go to
  
          @params
          snapshot - the snapshot that the files will be added to
          file_type - the type of file that will be added.  The need for this
              will depend on the particular implementation of the naming
              conventions
          file_name - the desired name of the file - most naming conventions
              will ignore this, but some will that the file name as a base
          file_range - if the file name is a range, then specify the range
          mkdir - an option which determines whether the directory of the
              preallocation should be created
          protocol - the protocol of the path returned
          ext - extension
          parent - parent of snapshot
          checkin_type - strict, auto, or ''
  
          @return
          returns a preallocated path
docstring_summary: Get a preallocated directory for this snapshot.  This will run a
          virtual checkin through the naming convention and construct a path
          that Tactic expects the checked in file to go to
docstring_tokens: Get a preallocated directory for this snapshot . This will run a virtual checkin through the naming convention and construct a path that Tactic expects the checked in file to go to
function: def get_preallocated_path(cls, snapshot, file_type='main', file_name='', file_range='', mkdir=True, protocol=None, ext='', parent=None, checkin_type=''):
          '''Get a preallocated directory for this snapshot.  This will run a
          virtual checkin through the naming convention and construct a path
          that Tactic expects the checked in file to go to
  
          @params
          snapshot - the snapshot that the files will be added to
          file_type - the type of file that will be added.  The need for this
              will depend on the particular implementation of the naming
              conventions
          file_name - the desired name of the file - most naming conventions
              will ignore this, but some will that the file name as a base
          file_range - if the file name is a range, then specify the range
          mkdir - an option which determines whether the directory of the
              preallocation should be created
          protocol - the protocol of the path returned
          ext - extension
          parent - parent of snapshot
          checkin_type - strict, auto, or ''
  
          @return
          returns a preallocated path
          '''
  
          # we need a dummy file_code and range
          #file_code = '123UNI'
          #if not file_range:
          #    file_range = "1-30"
  
          if not parent:
              parent = snapshot.get_parent()
          assert parent
  
          # if no file name is given, then we are just going to return a directory
          """
          if not file_name:
              file_name = parent.get_code()
              if not file_name:
                  file_name = parent.get_name()
              if not file_name:
                  file_name = "unknown"
          """
  
          # if there is no file name override, see if there is a file_object
          if file_type and not file_name:
              file_object = snapshot.get_file_by_type(file_type)
          else:
              file_object = None
  
  
          if file_object:
              naming_file_name = file_object.get_value("file_name")
          elif file_name:
              # if no file object exists the go through naming to find
              # the name
              file_object = SearchType.create("sthpw/file")
              file_object.set_value("file_name", file_name)
              file_object.set_value("type", file_type)
      
              # build the file name
              file_naming = Project.get_file_naming()
              file_naming.set_sobject(parent)
              file_naming.set_snapshot(snapshot)
              file_naming.set_file_object(file_object)
              file_naming.set_ext(ext)
              naming_file_name = file_naming.get_file_name()
          else:
              naming_file_name = None
  
          # if naming returns a file name, then use that one
          if naming_file_name:
              file_name = naming_file_name
          
              # update the file_name of the file_object from file_naming
              file_object.set_value("file_name", file_name)
        
          context = snapshot.get_context()
          process = snapshot.get_process()
          if not process:
              process = context
  
          # assume is_revision = False
          return_data = cls.process_checkin_type(checkin_type, parent, process,\
                  context , file_name, snapshot.get_value('snapshot_type'))
          dir_naming = return_data.get('dir_naming')
          file_naming = return_data.get('file_naming')
          
  
          lib_dir = snapshot.get_lib_dir(file_type=file_type, create=True, file_object=file_object, dir_naming=dir_naming)
          if mkdir and not os.path.exists(lib_dir):
              System().makedirs(lib_dir)
  
          # get the client lib dir
          if protocol == "client_repo":
              client_lib_dir = snapshot.get_client_lib_dir(file_type=file_type, create=True, file_object=file_object, dir_naming=dir_naming)
          elif protocol =='sandbox':
              client_lib_dir = snapshot.get_sandbox_dir(file_type=file_type)
          elif protocol =='web':
              client_lib_dir = snapshot.get_web_dir(file_type=file_type, file_object=file_object)
          else:
              client_lib_dir = snapshot.get_lib_dir(file_type=file_type, create=True, file_object=file_object, dir_naming=dir_naming)
  
          # put some protection in for ending slash
          client_lib_dir = client_lib_dir.rstrip("/")
  
          if file_name:
              path = "%s/%s" % (client_lib_dir, file_name)
          else:
              path = client_lib_dir
          return path
function_tokens: def get_preallocated_path ( cls , snapshot , file_type = 'main' , file_name = '' , file_range = '' , mkdir = True , protocol = None , ext = '' , parent = None , checkin_type = '' ) : # we need a dummy file_code and range #file_code = '123UNI' #if not file_range: #    file_range = "1-30" if not parent : parent = snapshot . get_parent ( ) assert parent # if no file name is given, then we are just going to return a directory """
          if not file_name:
              file_name = parent.get_code()
              if not file_name:
                  file_name = parent.get_name()
              if not file_name:
                  file_name = "unknown"
          """ # if there is no file name override, see if there is a file_object if file_type and not file_name : file_object = snapshot . get_file_by_type ( file_type ) else : file_object = None if file_object : naming_file_name = file_object . get_value ( "file_name" ) elif file_name : # if no file object exists the go through naming to find # the name file_object = SearchType . create ( "sthpw/file" ) file_object . set_value ( "file_name" , file_name ) file_object . set_value ( "type" , file_type ) # build the file name file_naming = Project . get_file_naming ( ) file_naming . set_sobject ( parent ) file_naming . set_snapshot ( snapshot ) file_naming . set_file_object ( file_object ) file_naming . set_ext ( ext ) naming_file_name = file_naming . get_file_name ( ) else : naming_file_name = None # if naming returns a file name, then use that one if naming_file_name : file_name = naming_file_name # update the file_name of the file_object from file_naming file_object . set_value ( "file_name" , file_name ) context = snapshot . get_context ( ) process = snapshot . get_process ( ) if not process : process = context # assume is_revision = False return_data = cls . process_checkin_type ( checkin_type , parent , process , context , file_name , snapshot . get_value ( 'snapshot_type' ) ) dir_naming = return_data . get ( 'dir_naming' ) file_naming = return_data . get ( 'file_naming' ) lib_dir = snapshot . get_lib_dir ( file_type = file_type , create = True , file_object = file_object , dir_naming = dir_naming ) if mkdir and not os . path . exists ( lib_dir ) : System ( ) . makedirs ( lib_dir ) # get the client lib dir if protocol == "client_repo" : client_lib_dir = snapshot . get_client_lib_dir ( file_type = file_type , create = True , file_object = file_object , dir_naming = dir_naming ) elif protocol == 'sandbox' : client_lib_dir = snapshot . get_sandbox_dir ( file_type = file_type ) elif protocol == 'web' : client_lib_dir = snapshot . get_web_dir ( file_type = file_type , file_object = file_object ) else : client_lib_dir = snapshot . get_lib_dir ( file_type = file_type , create = True , file_object = file_object , dir_naming = dir_naming ) # put some protection in for ending slash client_lib_dir = client_lib_dir . rstrip ( "/" ) if file_name : path = "%s/%s" % ( client_lib_dir , file_name ) else : path = client_lib_dir return path