def init_well_known(): reps = RedirectHTTPHandler.redirect_paths num_svcs = config.get_misc('http-well-known', 'num_services', '0') for nsv in range(1, int(num_svcs)+1): uri = config.get_misc('http-well-known', 'service_%d' % nsv, False) path = config.get_misc('http-well-known', 'path_%d' % nsv, False) if not (uri and path): continue reps['/'+uri] = path if int(num_svcs): reg_http_service('/.well-known', RedirectHTTPHandler)
def init_well_known(): reps = RedirectHTTPHandler.redirect_paths num_svcs = config.get_misc("http-well-known", "num_services", "0") for nsv in range(1, int(num_svcs) + 1): uri = config.get_misc("http-well-known", "service_%d" % nsv, False) path = config.get_misc("http-well-known", "path_%d" % nsv, False) if not (uri and path): continue reps["/" + uri] = path if int(num_svcs): reg_http_service("/.well-known", RedirectHTTPHandler)
def init_principals_redirect(): """ Some devices like the iPhone will look under /principals/users/xxx for the user's properties. In OpenERP we _cannot_ have a stray /principals/... working path, since we have a database path and the /webdav/ component. So, the best solution is to redirect the url with 301. Luckily, it does work in the device. The trick is that we need to hard-code the database to use, either the one centrally defined in the config, or a "forced" one in the webdav section. """ dbname = config.get_misc("webdav", "principal_dbname", False) if (not dbname) and not config.get_misc("webdav", "no_principals_redirect", False): dbname = config.get("db_name", False) if dbname: PrincipalsRedirect.redirect_paths[""] = "/webdav/%s/principals" % dbname reg_http_service("/principals", PrincipalsRedirect) _logger.info("Registered HTTP redirect handler for /principals to the %s db.", dbname)
def init_principals_redirect(): """ Some devices like the iPhone will look under /principals/users/xxx for the user's properties. In OpenERP we _cannot_ have a stray /principals/... working path, since we have a database path and the /webdav/ component. So, the best solution is to redirect the url with 301. Luckily, it does work in the device. The trick is that we need to hard-code the database to use, either the one centrally defined in the config, or a "forced" one in the webdav section. """ dbname = config.get_misc('webdav', 'principal_dbname', False) if (not dbname) and not config.get_misc('webdav', 'no_principals_redirect', False): dbname = config.get('db_name', False) if dbname: PrincipalsRedirect.redirect_paths[''] = '/webdav/%s/principals' % dbname reg_http_service('/principals', PrincipalsRedirect) _logger.info( "Registered HTTP redirect handler for /principals to the %s db.", dbname)
def init_well_known(): reps = RedirectHTTPHandler.redirect_paths num_svcs = config.get_misc('http-well-known', 'num_services', '0') for nsv in range(1, int(num_svcs)+1): uri = config.get_misc('http-well-known', 'service_%d' % nsv, False) path = config.get_misc('http-well-known', 'path_%d' % nsv, False) if not (uri and path): continue reps['/'+uri] = path if int(num_svcs): if http_server.reg_http_service(HTTPDir('/.well-known', RedirectHTTPHandler)): logging.getLogger("web-services").info("Registered HTTP redirect handler at /.well-known" )
def init_well_known(): reps = RedirectHTTPHandler.redirect_paths num_svcs = config.get_misc('http-well-known', 'num_services', '0') for nsv in range(1, int(num_svcs) + 1): uri = config.get_misc('http-well-known', 'service_%d' % nsv, False) path = config.get_misc('http-well-known', 'path_%d' % nsv, False) if not (uri and path): continue reps['/' + uri] = path if int(num_svcs): if http_server.reg_http_service( HTTPDir('/.well-known', RedirectHTTPHandler)): logging.getLogger("web-services").info( "Registered HTTP redirect handler at /.well-known")
def get_davpath(self): return "" try: if config.get_misc("webdav", "enable", True): directory = "/" + config.get_misc("webdav", "vdir", "webdav") handler = DAVHandler verbose = config.get_misc("webdav", "verbose", True) handler.debug = config.get_misc("webdav", "debug", True) _dc = {"verbose": verbose, "directory": directory, "lockemulation": True} conf = OpenDAVConfig(**_dc) handler._config = conf reg_http_service(directory, DAVHandler, DAVAuthProvider) _logger.info("WebDAV service registered at path: %s/ " % directory) if not (config.get_misc("webdav", "no_root_hack", False)): # Now, replace the static http handler with the dav-enabled one. # If a static-http service has been specified for our server, then # read its configuration and use that dir_path. # NOTE: this will _break_ any other service that would be registered # at the root path in future. base_path = False if config.get_misc("static-http", "enable", False): base_path = config.get_misc("static-http", "base_path", "/") if base_path and base_path == "/": dir_path = config.get_misc("static-http", "dir_path", False) else: dir_path = addons.get_module_resource("document_webdav", "public_html")
for argument in path[-1].split("&"): argument = argument.split("=") arguments[argument[0]] = argument[-1] use_cache = tools.config.get("jasper_cache", True) database = arguments.get("database", tools.config.get("jasper_database", "demo")) user = arguments.get("user", tools.config.get("jasper_user", "admin")) password = arguments.get("password", tools.config.get("jasper_password", "admin")) depth = int(arguments.get("depth", tools.config.get("jasper_depth", 3))) language = arguments.get("language", tools.config.get("jasper_language", "en")) # Check if data is in cache already key = "%s|%s|%s|%s|%s" % (model, database, user, depth, language) if key in self.cache: return self.cache[key] context = {"lang": language} uid = self.dispatch("common", "login", (database, user, password)) result = self.dispatch( "object", "execute", (database, uid, password, "ir.actions.report.xml", "create_xml", model, depth, context) ) if use_cache: self.cache[key] = result return result reg_http_service(HTTPDir("/jasper/", JasperHandler))
try: if (config.get_misc('webdav','enable',True)): directory = '/'+config.get_misc('webdav','vdir','webdav') handler = DAVHandler verbose = config.get_misc('webdav','verbose',True) handler.debug = config.get_misc('webdav','debug',True) _dc = { 'verbose' : verbose, 'directory' : directory, 'lockemulation' : True, } conf = OpenDAVConfig(**_dc) handler._config = conf reg_http_service(directory, DAVHandler, DAVAuthProvider) _logger.info("WebDAV service registered at path: %s/ "% directory) if not (config.get_misc('webdav', 'no_root_hack', False)): # Now, replace the static http handler with the dav-enabled one. # If a static-http service has been specified for our server, then # read its configuration and use that dir_path. # NOTE: this will _break_ any other service that would be registered # at the root path in future. base_path = False if config.get_misc('static-http','enable', False): base_path = config.get_misc('static-http', 'base_path', '/') if base_path and base_path == '/': dir_path = config.get_misc('static-http', 'dir_path', False) else: dir_path = addons.get_module_resource('document_webdav','public_html')
arguments = {} for argument in path[-1].split('&'): argument = argument.split('=') arguments[ argument[0] ] = argument[-1] use_cache = tools.config.get('jasper_cache', True) database = arguments.get('database', tools.config.get('jasper_database', 'demo') ) user = arguments.get('user', tools.config.get('jasper_user', 'admin') ) password = arguments.get('password', tools.config.get('jasper_password', 'admin') ) depth = int( arguments.get('depth', tools.config.get('jasper_depth', 3) ) ) language = arguments.get('language', tools.config.get('jasper_language', 'en')) # Check if data is in cache already key = '%s|%s|%s|%s|%s' % (model, database, user, depth, language) if key in self.cache: return self.cache[key] context = { 'lang': language, } uid = self.dispatch('common', 'login', (database, user, password) ) result = self.dispatch('object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context) ) if use_cache: self.cache[key] = result return result reg_http_service(HTTPDir('/jasper/', JasperHandler))
arguments = {} for argument in path[-1].split('&'): argument = argument.split('=') arguments[ argument[0] ] = argument[-1] use_cache = tools.config.get('jasper_cache', True) database = arguments.get('database', tools.config.get('jasper_database', 'demo') ) user = arguments.get('user', tools.config.get('jasper_user', 'admin') ) password = arguments.get('password', tools.config.get('jasper_password', 'admin') ) depth = int( arguments.get('depth', tools.config.get('jasper_depth', 3) ) ) language = arguments.get('language', tools.config.get('jasper_language', 'en')) # Check if data is in cache already key = '%s|%s|%s|%s|%s' % (model, database, user, depth, language) if key in self.cache: return self.cache[key] context = { 'lang': language, } uid = self.dispatch('common', 'login', (database, user, password) ) result = self.dispatch('object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context) ) if use_cache: self.cache[key] = result return result reg_http_service(HTTPDir('/jasper/', JasperHandler), StaticHTTPHandler)
arguments = {} for argument in path[-1].split('&'): argument = argument.split('=') arguments[ argument[0] ] = argument[-1] use_cache = tools.config.get('jasper_cache', True) database = arguments.get('database', tools.config.get('jasper_database', 'demo') ) user = arguments.get('user', tools.config.get('jasper_user', 'admin') ) password = arguments.get('password', tools.config.get('jasper_password', 'admin') ) depth = int( arguments.get('depth', tools.config.get('jasper_depth', 3) ) ) language = arguments.get('language', tools.config.get('jasper_language', 'en')) # Check if data is in cache already key = '%s|%s|%s|%s|%s' % (model, database, user, depth, language) if key in self.cache: return self.cache[key] context = { 'lang': language, } uid = netsvc.dispatch_rpc('common', 'login', (database, user, password)) result = netsvc.dispatch_rpc('object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context)) if use_cache: self.cache[key] = result return result reg_http_service('/jasper/', JasperHandler)
password = arguments.get('password', tools.config.get('jasper_password', 'admin')) depth = int(arguments.get('depth', tools.config.get('jasper_depth', 3))) language = arguments.get('language', tools.config.get('jasper_language', 'en')) # Check if data is in cache already key = '%s|%s|%s|%s|%s' % (model, database, user, depth, language) if key in self.cache: return self.cache[key] context = { 'lang': language, } uid = netsvc.dispatch_rpc('common', 'login', (database, user, password)) result = netsvc.dispatch_rpc( 'object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context)) if use_cache: self.cache[key] = result return result reg_http_service('/jasper/', JasperHandler)
try: if (config.get_misc('webdav', 'enable', True)): directory = '/' + config.get_misc('webdav', 'vdir', 'webdav') handler = DAVHandler verbose = config.get_misc('webdav', 'verbose', True) handler.debug = config.get_misc('webdav', 'debug', True) _dc = { 'verbose': verbose, 'directory': directory, 'lockemulation': True, } conf = OpenDAVConfig(**_dc) handler._config = conf reg_http_service(HTTPDir(directory, DAVHandler, DAVAuthProvider())) logging.getLogger('webdav').info( "WebDAV service registered at path: %s/ " % directory) if not (config.get_misc('webdav', 'no_root_hack', False)): # Now, replace the static http handler with the dav-enabled one. # If a static-http service has been specified for our server, then # read its configuration and use that dir_path. # NOTE: this will _break_ any other service that would be registered # at the root path in future. base_path = False if config.get_misc('static-http', 'enable', False): base_path = config.get_misc('static-http', 'base_path', '/') if base_path and base_path == '/': dir_path = config.get_misc('static-http', 'dir_path', False) else:
try: if (config.get_misc('webdav','enable',True)): directory = '/'+config.get_misc('webdav','vdir','webdav') handler = DAVHandler verbose = config.get_misc('webdav','verbose',True) handler.debug = config.get_misc('webdav','debug',True) _dc = { 'verbose' : verbose, 'directory' : directory, 'lockemulation' : True, } conf = OpenDAVConfig(**_dc) handler._config = conf reg_http_service(HTTPDir(directory,DAVHandler,DAVAuthProvider())) logging.getLogger('webdav').info("WebDAV service registered at path: %s/ "% directory) if not (config.get_misc('webdav', 'no_root_hack', False)): # Now, replace the static http handler with the dav-enabled one. # If a static-http service has been specified for our server, then # read its configuration and use that dir_path. # NOTE: this will _break_ any other service that would be registered # at the root path in future. base_path = False if config.get_misc('static-http','enable', False): base_path = config.get_misc('static-http', 'base_path', '/') if base_path and base_path == '/': dir_path = config.get_misc('static-http', 'dir_path', False) else: dir_path = addons.get_module_resource('document_webdav','public_html')