Set current folder and return associated model index
344699
def set_current_folder(self, folder):
        """"""
        index = self.fsmodel.setRootPath(folder)
        self.__last_folder = folder
        if self.show_cd_only:
            if self.__original_root_index is None:
                self.__original_root_index = self.rootIndex()
            self.setRootIndex(index)
        return index
326409
def store_dir
      default_path = "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"

      return File.join(Decidim.base_uploads_path, default_path) if Decidim.base_uploads_path.present?
      default_path
    end
212718
def set(self, index, value=None, dir=False, ttl=None, expiration=None):
        """"""
        if bool(dir) is (value is not None):
            raise TypeError('Choose one of value or directory')
        if (ttl is not None) is (expiration is None):
            raise TypeError('Both of ttl and expiration required')
        self.value = value
        if self.dir != dir:
            self.dir = dir
            self.nodes = {} if dir else None
        self.ttl = ttl
        self.expiration = expiration
        self.modified_index = index
201303
def _index(self, model):
        '''
        
        '''
        doc_type = model
        if not isinstance(model, str):
            doc_type = model.__table__.name

        index_name = doc_type
        if hasattr(model, "__msearch_index__"):
            index_name = model.__msearch_index__

        if doc_type not in self._indexs:
            self._indexs[doc_type] = Index(self._client, index_name, doc_type)
        return self._indexs[doc_type]
1152886
def view_set_dir(collection)
      Model::AppResourceDir.first(collection: collection,
                                  discipline: collection.discipline,
                                  UserType: @name.to_s,
                                  IsPersonal: false)
    end
354457
def setModelData( self, editor, model, index ):
        
        tree        = self.parent()
        querywidget = tree.parent()
        factory     = querywidget.factory()
        item        = tree.itemFromIndex(index)
        
        value = factory.editorData(editor)
        item.setValue(value)
320726
def project_new_folder(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/newFolder' % object_id, input_params, always_retry=always_retry, **kwargs)
590930
def __set_workdir(self):
        """"""
        fname = self.get_current_filename()
        if fname is not None:
            directory = osp.dirname(osp.abspath(fname))
            self.open_dir.emit(directory)
1505
def setModelData(self, editor, model, index):
        
        value = editor.currentText()
        model.setData(index, wrapVariant(value))
519301
def current_index(self):
        """"""
        i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
        return i
1009895
def index(self, request):
        """"""
        objects = self.model.objects.all()

        return self._render(
            request = request,
            template = 'index',
            context = {
                cc2us(pluralize(self.model.__name__)): objects,
            },
            status = 200
        )
908263
def __init(self, folder='/'):
        """"""
        params = {
            "f" : "json"
        }
        if folder is None or folder == "/":
            folder = 'root'
        result_template = {
            "username": "",
            "total": 0,
            "start": 1,
            "num": 0,
            "nextStart": 0,
            "currentFolder": None,
            "items": [],
            "folders": []
        }
        nextStart = 1
        self._json_dict = {}
        self._json = ""
        while nextStart > -1:
            res = self.search(start=nextStart, num=100)
            if self._location.find(res['username'].lower()) > -1:
                self._location = self._location.replace(res['username'].lower(), res['username'])
                self._url = self._url.replace(res['username'].lower(), res['username'])

            nextStart = int(res['nextStart'])
            result_template['username'] = res['username']
            result_template["total"] = res["total"]
            result_template['nextStart'] = res['nextStart']
            result_template['start'] = res['start']
            result_template['num'] = res['num']

            #Added so the root has content to match when in a folder,
            #not sure if this is best practice or not.  Did not add
            #username and created
            #if res['currentFolder'] is None:
                #result_template['currentFolder'] = {
                    #'title': 'root',
                    #'id': None,
                    #'created' : None,
                    #'username' : None
                #}
                #result_template['folders'].insert(0, result_template['currentFolder'])
            #else:
            result_template['currentFolder'] = res['currentFolder']
            for item in res['items']:
                if item not in result_template['items']:
                    result_template['items'].append(item)
            #if 'folders' in res and \
               #folder.lower() == 'root':
                #for folder in res['folders']:
                    #if folder not in result_template['folders']:
                        #result_template['folders'].append(folder)

        self._json_dict = result_template
        self._json = json.dumps(result_template)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]
        for k,v in result_template.items():
            if k in attributes:
                setattr(self, "_"+ k, result_template[k])
            else:
                print( k, " - attribute not implemented in Content.User class.")

        self._loadFolders()
575939
def mkdir(self, name=None, folder_id='0'):
		''''''
		return self( 'folders', method='post', encode='json',
			data=dict(name=name, parent=dict(id=folder_id)) )
539583
def get_model_path(self, name):
        """"""

        name, ext = os.path.splitext(name)
        ext = '.xml'
        xmlfile = name + self.config['file_suffix'] + ext
        xmlfile = utils.resolve_path(xmlfile,
                                     workdir=self.config['fileio']['workdir'])

        return xmlfile
1040319
def db_set_indexing(cls, is_indexing, impl, working_dir):
        
        indexing_lockfile_path = config.get_lockfile_filename(impl, working_dir)
        if is_indexing:
            # make sure this exists
            with open(indexing_lockfile_path, 'w') as f:
                pass

        else:
            # make sure it does not exist 
            try:
                os.unlink(indexing_lockfile_path)
            except:
                pass
1022416
function mkdirs(folderPath, mode) {
  var folders = [];
  var tmpPath = path.normalize(folderPath);
  var exists = fs.existsSync(tmpPath);
  while (!exists) {
    folders.push(tmpPath);
    tmpPath = path.join(tmpPath, '..');
    exists = fs.existsSync(tmpPath);
  }

  for (var i = folders.length - 1; i >= 0; i--) {
    fs.mkdirSync(folders[i], mode);
  }
}
1020739
def current(directory=None, verbose=False, head_only=False):
    """"""
    config = current_app.extensions['migrate'].migrate.get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.current(config, verbose=verbose, head_only=head_only)
    else:
        command.current(config)