예제 #1
0
    def render(self, context):
        output = self.nodelist.render(context)
        try:
            _setc2Ctx(context, self.obj, DICTJSON.fromJSON(output))
        except Exception as inst:
            milog.error("Error al convertir a JSON %s", inst)
            if settings.DEBUG:
                return "ERROR PROCESADO JSON" + output

        return ""
예제 #2
0
파일: YBtools.py 프로젝트: yeboyebo/AQNext
    def render(self, context):
        output = self.nodelist.render(context)
        try:
            _setc2Ctx(context, self.obj, DICTJSON.fromJSON(output))
        except Exception as inst:
            milog.error("Error al convertir a JSON %s", inst)
            if settings.DEBUG:
                return "ERROR PROCESADO JSON" + output

        return ""
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
0
    def yblogin_permissions_request(self, request):
        if request.method == "POST":
            return HttpResponseRedirect("/")

        reg = open(path.join(settings.PROJECT_ROOT, "config/urls.json")).read()
        oReg = DICTJSON.fromJSON(reg)
        models = {}

        for mod in oReg["models"]:
            for modelName in oReg["models"][mod]:
                acciones = factorias.FactoriaAccion.getAcciones(modelName, "I")
                models[modelName] = []
                for a in acciones:
                    models[modelName].append(a)
        # miaccion = factorias.FactoriaAccion.getAcciones("telsac", 'I')

        return render(request, "portal/permissions.html", {"models": models})
예제 #8
0
 def render(self, context):
     output = self.nodelist.render(context)
     try:
         obj2 = DICTJSON.fromJSON(output)
     except Exception as inst:
         milog.error("Error al convertir a JSON %s", inst)
         if settings.DEBUG:
             return "ERROR PROCESADO JSON" + output
     isquery = True
     if obj2["TIPO"] == "I" or obj2["TIPO"] == "O":
         isquery = False
     context.push()
     aux = viewsets.YBMIXINCTXtemplate.respuestapeticionCTX(
         context, obj2["APLICACION"], obj2["PREFIJO"], obj2["TEMPLATE"],
         obj2.get("QUERYSTRING", {}), obj2.get("PK", None), isquery,
         obj2.get("MODIF", None), obj2.get("PARAM", None))
     context.pop()
     return aux
예제 #9
0
파일: YBtools.py 프로젝트: yeboyebo/AQNext
 def render(self, context):
     output = self.nodelist.render(context)
     try:
         obj2 = DICTJSON.fromJSON(output)
     except Exception as inst:
         milog.error("Error al convertir a JSON %s", inst)
         if settings.DEBUG:
             return "ERROR PROCESADO JSON" + output
     isquery = True
     if obj2["TIPO"] == "I" or obj2["TIPO"] == "O":
         isquery = False
     context.push()
     aux = viewsets.YBMIXINCTXtemplate.respuestapeticionCTX(
         context,
         obj2["APLICACION"],
         obj2["PREFIJO"],
         obj2["TEMPLATE"],
         obj2.get("QUERYSTRING", {}),
         obj2.get("PK", None),
         isquery,
         obj2.get("MODIF", None),
     )
     context.pop()
     return aux
예제 #10
0
from os import path

from AQNEXT.settings import PROJECT_ROOT
from YBAQNEXT.settings import INSTALLED_APPS
from YBWEB.ctxJSON import DICTJSON

YEBO_APPS = ()
CONTROLLER_APPS = ()
API_APPS = ()

rest = open(path.join(PROJECT_ROOT, "config/urls.json")).read()
oRest = DICTJSON.fromJSON(rest)

for app in oRest:
    if "controller" in oRest[app]:
        CONTROLLER_APPS += (app, )
    elif "api" in oRest[app]:
        API_APPS += (app, )
    else:
        YEBO_APPS += (app, )

INSTALLED_APPS += YEBO_APPS
INSTALLED_APPS += CONTROLLER_APPS
INSTALLED_APPS += API_APPS
# INSTALLED_APPS += ('channels', )
예제 #11
0
 def test_fromJSON(self):
     str_json = '{"a": "b", "c": {"d": "e"}}'
     json = OrderedDict([('a', 'b'), ('c', OrderedDict([('d', 'e')]))])
     self.assertEqual(DICTJSON.fromJSON(str_json), json)
예제 #12
0
def cargaDictJSON(templatechain, requestcontext=None):
    # return DICTJSON.fromJSON("{" + cargaString(templatechain, requestcontext) + "}")
    return DICTJSON.fromJSON(cargaString(templatechain, requestcontext))