Forked from
DM / dm-docs
261 commits behind, 112 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
fsController.py 1.40 KiB
#!/usr/bin/env python
#######################################################################
import cherrypy
from dm.common.service.dmController import DmController
from dm.common.objects.dmObject import DmObject
from dm.common.exceptions.dmException import DmException
from dm.common.exceptions.internalError import InternalError
from dm.common.exceptions.invalidRequest import InvalidRequest
from dm.fs_service.impl.fsControllerImpl import FsControllerImpl
#######################################################################
class FsController(DmController):
def __init__(self):
DmController.__init__(self)
self._fsControllerImpl = FsControllerImpl()
@cherrypy.expose
def getDirectoryList(self, **kwargs):
try:
if not kwargs.has_key('path'):
raise InvalidRequest('Missing directory path.')
path = kwargs.get('path')
response = '%s' % self._fsControllerImpl.getDirectoryList(path).getJsonRep()
self.getLogger().debug('Returning: %s' % response)
except DmException, ex:
self.getLogger().error('%s' % ex)
self.handleException(ex)
response = ex.getJsonRep()
except Exception, ex:
self.getLogger().error('%s' % ex)
self.handleException(ex)
response = InternalError(ex).getJsonRep()
return self.formatJsonResponse(response)