def __init__(self, cmd_channel, client): FilesystemBase.__init__(self, 'osis', cmd_channel) self.cwd = "/" self.list = [] self.name2path = {} self.ftproot = "/%s" % 'osis' self.client = client self.actors = [Text.toStr(a) for a in j.apps.system.contentmanager.getActors()]
def _listdir(self, parts): dirs = [] if not parts: dirs = [x.split('__')[0] for x in self.actors] elif len(parts) == 1: dirs = [x.split('__')[1] for x in self.actors if x.startswith(parts[0])] elif len(parts) == 2: print '***** %s' % parts actor = self._getActorClient(*parts) if hasattr(actor, 'models'): dirs = [x[0] for x in inspect.getmembers(getattr(actor, 'models')) if not x[0].startswith('_')] elif len(parts) == 3: actor = self._getActorClient(*parts[0:2]) methodname = "model_%s_list" % parts[2] if hasattr(actor, methodname): try: dirs = ["%s.hrd" % Text.toStr(x) for x in getattr(actor, methodname)()] except Exception as e: j.errorconditionhandler.processPythonExceptionObject(e) raise OSError(errno.EIO, "Failed to list") return list(set(dirs))