def __init__(self): self.template = os.path.join(os.path.dirname(__file__), 'spellchecker.html') self.NWORDS = None self.lang = None self.dictionaries = {} self.response = SilpaResponse(self.template)
def serve(self, environ, start_response): """ The method to serve all the requests. """ request = SilpaRequest(environ) request_uri = environ.get('PATH_INFO', '').lstrip('/') #JSON RPC requests if request_uri == "JSONRPC": data = request.get_body() start_response('200 OK', [('Content-Type', 'application/json')]) jsonreponse = self._jsonrpc_handler.handleRequest(data) return [jsonreponse.encode('utf-8')] #Check if the action is defined. if self._module_manager.find_module(request_uri): module_instance = self._module_manager.get_module_instance( request_uri) if (module_instance): module_instance.set_request(request) module_instance.set_start_response(start_response) #if this is a json request if request.get('json'): jsonreponse = module_instance.get_json_result() start_response('200 OK', [('Content-Type', 'application/json')]) return [jsonreponse.encode('utf-8')] response = module_instance.get_response() start_response(response.response_code, response.header) return [str(response.content).encode('utf-8')] response = SilpaResponse() if (request_uri == "index.html" or request_uri == ""): start_response('200 OK', [('Content-Type', 'text/html')]) response.content.content = get_index_page() else: response.content.content = 'Requested URL not found.' start_response('404 Not found', [('Content-Type', 'text/html')]) return [str(response.content).encode('utf-8')]
def __init__(self): self.template = os.path.join(os.path.dirname(__file__), 'index.html') self.font = None #List of available fonts self.available_fonts=fonts.fonts self.response = SilpaResponse(self.template)
def __init__(self): self.template = os.path.join(os.path.dirname(__file__), "tts.html") self.response = SilpaResponse(self.template)
def __init__(self): self.dh = dhvani.dhvani_init() self.template = os.path.join(os.path.dirname(__file__), "tts.html") self.tmp_folder = os.path.join(os.path.dirname(__file__), "tmp") self.response = SilpaResponse(self.template)
def __init__(self): self.template = os.path.join(os.path.dirname(__file__), "render.html") self.tmp_folder = os.path.join(os.path.dirname(__file__), "tmp") self.response = SilpaResponse(self.template)