def __init__(self, path, userid):
    print('  FCLS PATH', path, userid)
    path = os.path.normpath(path).replace(os.path.sep, '/')
    diskpath = local_to_real(path)
    froot = local_to_real('/')
    if (not os.path.exists(diskpath)):
        self.bad = True
        return
    else:
        try:
            nstat = dostat(diskpath)
        except:
            self.bad = True
            return
    rootid = fileapi_db.fileid_to_publicid(userid, ROOT_PARENT_ID)
    if stat.S_ISDIR(nstat.st_mode):
        mime = FOLDER_MIME
        self.is_dir = True
    else:
        mime = 'application/x-javascript'
        self.is_dir = False
    self.name = ''
    self.bad = False
    if ((not serv_all_local) and (not diskpath.startswith(froot))):
        elog(('Error! ' + diskpath))
        print('Error!', diskpath, froot)
        self.bad = True
        return
    self.diskpath = diskpath
    self.mimeType = mime
    self.id = fileid_to_publicid(path, userid)
    oname = path
    while ((len(oname) > 0) and (oname[0] in ['\\', '/'])):
        oname = oname[1:]
    name = oname[(oname.rfind('/') + 1):].strip()
    name = name.replace('/', '')
    if (name == ''):
        name = oname
    self.name = name
    parentpath = path[:path.rfind('/')].strip()
    if ('/' not in path):
        parentpath = '/'
    if ((name == '/') or (parentpath == '/') or (parentpath == '')):
        self.parentid = rootid
    else:
        self.parentid = fileid_to_publicid(parentpath, userid)
def __init__(self, path, userid):
    print('  FCLS PATH', path, userid)
    path = os.path.normpath(path).replace(os.path.sep, '/')
    diskpath = local_to_real(path)
    froot = local_to_real('/')
    if (not os.path.exists(diskpath)):
        self.bad = True
        return
    else:
        try:
            nstat = dostat(diskpath)
        except:
            self.bad = True
            return
    rootid = fileapi_db.fileid_to_publicid(userid, ROOT_PARENT_ID)
    if stat.S_ISDIR(nstat.st_mode):
        mime = FOLDER_MIME
        self.is_dir = True
    else:
        mime = 'application/x-javascript'
        self.is_dir = False
    self.name = 
    self.bad = False
    if ((not serv_all_local) and (not diskpath.startswith(froot))):
        elog(('Error! ' + diskpath))
        print('Error!', diskpath, froot)
        self.bad = True
        return
    self.diskpath = diskpath
    self.mimeType = mime
    self.id = fileid_to_publicid(path, userid)
    oname = path
    while ((len(oname) > 0) and (oname[0] in ['\\', '/'])):
        oname = oname[1:]
    name = oname[(oname.rfind('/') + 1):].strip()
    name = name.replace('/', )
    if (name == ):
        name = oname
    self.name = name
    parentpath = path[:path.rfind('/')].strip()
    if ('/' not in path):
        parentpath = '/'
    if ((name == '/') or (parentpath == '/') or (parentpath == )):
        self.parentid = rootid
    else:
        self.parentid = fileid_to_publicid(parentpath, userid)