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)
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)
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)
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)