예제 #1
0
파일: YBtools.py 프로젝트: yeboyebo/AQNext
def toJSON(context, elem_cont):
    """
        Convierte elemento a JSON
    """
    if isinstance(elem_cont, str):
        obj = _c2Ctx(context, elem_cont)
    else:
        obj = elem_cont
    try:
        return DICTJSON.toJSON(obj)
    except:
        return str(obj)
예제 #2
0
def toJSON(context, elem_cont):
    """
        Convierte elemento a JSON
    """
    if isinstance(elem_cont, str):
        obj = _c2Ctx(context, elem_cont)
    else:
        obj = elem_cont
    try:
        return DICTJSON.toJSON(obj)
    except Exception:
        return str(obj)
예제 #3
0
파일: YBtools.py 프로젝트: yeboyebo/AQNext
def envDATA(context, elem_cont):
    """
        Para Probar cosas, mostrara por pantalla usuario, conexion a BBDD...
    """
    resul = list()
    try:
        from YBUTILS.DbRouter import dameConexionDef
        from django.db import connection
        from copy import deepcopy

        micon = dameConexionDef()
        resul.append("BBDD POR LIBRERIA--------------------------")
        resul.append(micon.alias)
        auxdict = deepcopy(micon.settings_dict)
        auxdict["PASSWORD"] = "******"
        resul.append(DICTJSON.toJSON(auxdict))
        micon = dameConexionDef()
        resul.append("BBDD django.db.connection-------------------")
        micon = connection
        resul.append(micon.alias)
        auxdict = deepcopy(micon.settings_dict)
        auxdict["PASSWORD"] = "******"
        resul.append(DICTJSON.toJSON(auxdict))
    except:
        pass
    try:
        # requiere TEMPLATE_CONTEXT_PROCESSORS=('django.core.context_processors.request',)
        mireq = context["request"]
        resul.append("HTTP HEADERS-------------------")
        for k, v in mireq.META.items():
            try:

                resul.append(str(k) + "--->" + str(v))
            except:
                pass

    except:
        pass

    return "<br/>".join(resul)
예제 #4
0
def envDATA(context, elem_cont):
    """
        Para Probar cosas, mostrara por pantalla usuario, conexion a BBDD...
    """
    resul = list()
    try:
        from YBUTILS.DbRouter import dameConexionDef
        from django.db import connection
        from copy import deepcopy
        micon = dameConexionDef()
        resul.append("BBDD POR LIBRERIA--------------------------")
        resul.append(micon.alias)
        auxdict = deepcopy(micon.settings_dict)
        auxdict["PASSWORD"] = "******"
        resul.append(DICTJSON.toJSON(auxdict))
        micon = dameConexionDef()
        resul.append("BBDD django.db.connection-------------------")
        micon = connection
        resul.append(micon.alias)
        auxdict = deepcopy(micon.settings_dict)
        auxdict["PASSWORD"] = "******"
        resul.append(DICTJSON.toJSON(auxdict))
    except Exception:
        pass
    try:
        # requiere TEMPLATE_CONTEXT_PROCESSORS=('django.core.context_processors.request',)
        mireq = context['request']
        resul.append("HTTP HEADERS-------------------")
        for k, v in mireq.META.items():
            try:
                resul.append(str(k) + "--->" + str(v))
            except Exception:
                pass
    except Exception:
        pass

    return "<br/>".join(resul)