parameters: (self, httpRequest = [])
return_statement: return self.httpStatusCode, self.httpHeader, self.httpResponse
docstring: main function
docstring_summary: main function
docstring_tokens: main function
function: def run(self, httpRequest = []):
  		"""main function"""
  		self.__reset()
  		rootOk = True
  		if not os.path.exists(self._options['root']) or self._options['root'] == '':
  			rootOk = False
  			self._response['error'] = 'Invalid backend configuration'
  		elif not self.__isAllowed(self._options['root'], 'read'):
  			rootOk = False
  			self._response['error'] = 'Access denied'
  
  		for field in self.httpAllowedParameters:
  			if field in httpRequest:
  				self._request[field] = httpRequest[field]
  
  		if rootOk is True:
  			if 'cmd' in self._request:
  				if self._request['cmd'] in self._commands:
  					cmd = self._commands[self._request['cmd']]
  					func = getattr(self, '_' + self.__class__.__name__ + cmd, None)
  					if callable(func):
  						try:
  							func()
  						except Exception, e:
  							self._response['error'] = 'Command Failed'
  							self.__debug('exception', str(e))
  				else:
  					self._response['error'] = 'Unknown command'
  			else:
  				self.__open()
  
  			if 'init' in self._request:
  				self.__checkArchivers()
  				self._response['disabled'] = self._options['disabled']
  				if not self._options['fileURL']:
  					url = ''
  				else:
  					url = self._options['URL']
  				self._response['params'] = {
  					'dotFiles': self._options['dotFiles'],
  					'uplMaxSize': str(self._options['uploadMaxSize']) + 'M',
  					'archives': self._options['archiveMimes'],
  					'extract': self._options['archivers']['extract'].keys(),
  					'url': url
  				}
  
  		if self._errorData:
  			self._response['errorData'] = self._errorData
  
  		if self._options['debug']:
  			self.__debug('time', (time.time() - self._time))
  		else:
  			if 'debug' in self._response:
  				del self._response['debug']
  
  		if self.httpStatusCode < 100:
  			self.httpStatusCode = 200
  
  		if not 'Content-type' in self.httpHeader:
  			if ('cmd' in self._request and self._request['cmd'] == 'upload') or self._options['debug']:
  				self.httpHeader['Content-type'] = 'text/html'
  			else:
  				self.httpHeader['Content-type'] = 'application/json'
  
  		self.httpResponse = self._response
  
  		return self.httpStatusCode, self.httpHeader, self.httpResponse
function_tokens: def run ( self , httpRequest = [ ] ) : self . __reset ( ) rootOk = True if not os . path . exists ( self . _options [ 'root' ] ) or self . _options [ 'root' ] == '' : rootOk = False self . _response [ 'error' ] = 'Invalid backend configuration' elif not self . __isAllowed ( self . _options [ 'root' ] , 'read' ) : rootOk = False self . _response [ 'error' ] = 'Access denied' for field in self . httpAllowedParameters : if field in httpRequest : self . _request [ field ] = httpRequest [ field ] if rootOk is True : if 'cmd' in self . _request : if self . _request [ 'cmd' ] in self . _commands : cmd = self . _commands [ self . _request [ 'cmd' ] ] func = getattr ( self , '_' + self . __class__ . __name__ + cmd , None ) if callable ( func ) : try : func ( ) except Exception , e : self . _response [ 'error' ] = 'Command Failed' self . __debug ( 'exception' , str ( e ) ) else : self . _response [ 'error' ] = 'Unknown command' else : self . __open ( ) if 'init' in self . _request : self . __checkArchivers ( ) self . _response [ 'disabled' ] = self . _options [ 'disabled' ] if not self . _options [ 'fileURL' ] : url = '' else : url = self . _options [ 'URL' ] self . _response [ 'params' ] = { 'dotFiles' : self . _options [ 'dotFiles' ] , 'uplMaxSize' : str ( self . _options [ 'uploadMaxSize' ] ) + 'M' , 'archives' : self . _options [ 'archiveMimes' ] , 'extract' : self . _options [ 'archivers' ] [ 'extract' ] . keys ( ) , 'url' : url } if self . _errorData : self . _response [ 'errorData' ] = self . _errorData if self . _options [ 'debug' ] : self . __debug ( 'time' , ( time . time ( ) - self . _time ) ) else : if 'debug' in self . _response : del self . _response [ 'debug' ] if self . httpStatusCode < 100 : self . httpStatusCode = 200 if not 'Content-type' in self . httpHeader : if ( 'cmd' in self . _request and self . _request [ 'cmd' ] == 'upload' ) or self . _options [ 'debug' ] : self . httpHeader [ 'Content-type' ] = 'text/html' else : self . httpHeader [ 'Content-type' ] = 'application/json' self . httpResponse = self . _response return self . httpStatusCode , self . httpHeader , self . httpResponse