Exemplo n.º 1
0
def _get_current_registry(api=None):
  # import ipdb;ipdb.set_trace()
  global registry
  app_name = None
  overrides = {}
  if api:
    app_name = api.blueprint.name if api.blueprint else None
  else:
    app_name = request.blueprint
    urlparts =  urlparse.urlparse(request.url_root.rstrip('/'))
    proto = request.headers.get("x-forwarded-proto") or urlparts[0]
    overrides = {'basePath': urlparse.urlunparse([proto] + list(urlparts[1:]))}

  if not app_name:
    app_name = 'app'

  overrides['models'] = registry.get('models', {})

  reg = registry.setdefault(app_name, {})
  reg.update(overrides)

  reg['basePath'] = reg['basePath'] + reg.get('x-api-prefix', '')
  reg['basePath'] = reg["basePath"].replace("http://localhost:5000/", "/")

  return reg
Exemplo n.º 2
0
def _get_current_registry(api=None):
    # import ipdb;ipdb.set_trace()
    global registry
    app_name = None
    overrides = {}
    if api:
        app_name = api.blueprint.name if api.blueprint else None
    else:
        app_name = request.blueprint
        urlparts = urlparse.urlparse(request.url_root.rstrip('/'))
        proto = request.headers.get("x-forwarded-proto") or urlparts[0]
        overrides = {
            'basePath': urlparse.urlunparse([proto] + list(urlparts[1:]))
        }

    if not app_name:
        app_name = 'app'

    overrides['models'] = registry.get('models', {})

    reg = registry.setdefault(app_name, {})
    reg.update(overrides)

    reg['basePath'] = reg['basePath'] + reg.get('x-api-prefix', '')

    return reg
Exemplo n.º 3
0
def _get_current_registry(api=None):
    # import ipdb;ipdb.set_trace()
    global registry
    app_name = None
    overrides = {}
    if api:
        app_name = api.blueprint.name if api.blueprint else None
    else:
        app_name = request.blueprint
        urlparts = urlparse.urlparse(request.url_root.rstrip("/"))
        proto = request.headers.get("x-forwarded-proto") or urlparts[0]
        overrides = {
            "basePath": urlparse.urlunparse([proto] + list(urlparts[1:])),
        }

    if not app_name:
        app_name = "app"

    overrides["models"] = registry.get("models", {})

    reg = registry.setdefault(app_name, {})
    reg.update(overrides)

    reg["basePath"] = reg["basePath"] + (reg.get("x-api-prefix", "") or "")

    return reg
Exemplo n.º 4
0
def _get_current_registry(api=None):
  # import ipdb;ipdb.set_trace()
  global registry
  app_name = None
  overrides = {}
  if api:
    app_name = api.blueprint.name if api.blueprint else None
  else:
    app_name = request.blueprint
    overrides = {'basePath': request.url_root.rstrip('/')}

  if not app_name:
    app_name = 'app'

  overrides['models'] = registry.get('models', {})

  reg = registry.setdefault(app_name, {})
  reg.update(overrides)

  reg['basePath'] = reg['basePath'] + reg.get('x-api-prefix', '')

  return reg
Exemplo n.º 5
0
def _get_current_registry(api=None):
  # import ipdb;ipdb.set_trace()
  global registry
  app_name = None
  overrides = {}
  if api:
    app_name = api.blueprint.name if api.blueprint else None
  else:
    app_name = request.blueprint
    overrides = {'basePath': request.url_root.rstrip('/')}

  if not app_name:
    app_name = 'app'

  overrides['models'] = registry.get('models', {})

  reg = registry.setdefault(app_name, {})
  reg.update(overrides)

  reg['basePath'] = reg['basePath'] + reg.get('x-api-prefix', '')

  return reg