Пример #1
0
	def metodo_desconocido(self):
		
		from modulos.ztec.zred import gringolizar
		if self.data["app"]!=None:
		  	import settings.config as settings
		  	import settings.routes as routes
		
		#self.vista="error404"
		
		
		for elem in self.data["model"][self.model_name].obtenerFilas(self.tabla):

			if self.data["metodo"]==None:
				
				if gringolizar(elem[0],"-")==self.data["control"]:
					metadatos=self.data["model"][self.model_name].formatearMetadatos(elem[4])
					self.data["post"]=elem[1]
					self.vista=metadatos["layout"]
			else:

				if gringolizar(elem[0],"-")==self.data["metodo"]:

					metadatos=self.data["model"][self.model_name].formatearMetadatos(elem[4])
					self.data["post"]=elem[1]

					self.vista=metadatos["layout"]

		self.servir()
Пример #2
0
	def __init__(self,data):
		import os
		self.data=data

		from config import config
		from modulos.ztec.zred import gringolizar
		import imp

		if self.data["control"] in os.listdir(config.base_root+config.plugins_folder):

			control=imp.load_source("",config.base_root+config.plugins_folder+self.data["control"]+"/default.py").Plugin(self.data)
			


			if self.data["metodo"]!=None:
				


				if gringolizar(self.data["metodo"]) in dir(control):
					
					exec("control."+gringolizar(self.data["metodo"])+"()")


				else:
					control.metodo_desconocido()
Пример #3
0
	def Entrada(self):
		"""
		Este metodo se usa para crear o modificar una pagina en espacifico
		"""
		from modulos.ztec.zred import normalizar,gringolizar
		
		if self.data["ajax"]==False:


			if self.data["action"]=="editar":
				#self.HEADERS.set_headers({"Content-type":"text/plain\n"})
				self.HEADERS.show()
				self.data["repeate"]=1
				self.data["plantillas"]=self.data["model"]["main"].obtenerFilas("Plantillas")

				
				keys=self.data["args"][0]
				i=normalizar(self.data["args"][0])
				self.data["categorias"]={}

				self.data["titulo"]=self.data["metodo"]
				if i!=None:

					self.data["categorias"]={}
					tabla=self.data["model"]["paginas"].obtenerFilas("Entradas")[i]
					self.data["titulo"]=tabla[0]
					self.data["meta-layout"]=self.data["model"]["paginas"].exportarMetadato(tabla[4],"layout")
					self.data["meta-control"]=self.data["model"]["paginas"].exportarMetadato(tabla[4],"control")

					self.data["post"]=gringolizar(self.data["titulo"],"-")
					self.data["control-post"]="Blog"
					l1=self.data["model"]["paginas"].obtenerFilas("Entradas")[i][1]
					self.data["boxes"]=[l1]
				else:
					self.data["titulo"]="Crea una nueva entrada"
					self.data["layout"]=self.data["titulo"]
					self.data["post"]=gringolizar(self.data["titulo"],"-")
					self.data["control-post"]="Inicio"
					self.data["boxes"]=[self.data["model"]["paginas"].obtenerEstructura("Entradas")[1]]

				modelos=self.data["model"]["main"].obtenerFilas('Tablas,args>Modelos')[0][0]
				tablas=self.data["model"]["main"].obtenerFilas('args>Tablas')[0][0]
				
				self.data["vars"]["modelos"]=modelos
				self.data["vars"]["opciones"]=self.data["model"][modelos[self.data["metodo"]]].obtenerFilas('Opciones')
				self.data["vars"]["Tablas"]=tablas
				self.servir()
			elif self.data["action"]=="save":           
				#self.HEADERS.set_headers({"Content-type":"text/plain\n"})
				self.HEADERS.show()

				if self.data["args"][0]!=None:
					self.data["model"]["paginas"].modificarEntrada(self.data["args"][0],self.data["request"],self.data["metadatos"])
					redirecter(config,settings.app,"admin","Entrada",str(self.data["args"][0]),action="editar")()
				else:
					self.data["model"]["paginas"].crearEntrada(self.data["request"],self.data["metadatos"])
					redirecter(config,settings.app,"admin","Entrada","None",action="editar")()
Пример #4
0
                def __call__(self, data):

                    controladores = self.root.admin.settings.http

                    if data["control"] in controladores:

                        control = imp.load_source(
                            "", self.__path__ + data["control"] + ".py")

                        exec("ncontrol=control." + data["control"] +
                             "(data,self.HEADERS)")

                        if data["metodo"] != None:

                            metodo = gringolizar(data["metodo"], "_")

                            if metodo in dir(ncontrol):
                                exec("ncontrol." + metodo + "()")

                            else:
                                exec("ncontrol.metodo_desconocido()")

                    elif data["control"] == "Plugin":
                        from config import config
                        import os

                        for plugin in data["model"]["main"].obtenerFilas(
                                "Plugins"):

                            if data["metodo"] == plugin[0] and os.path.exists(
                                    config.base_root + config.plugins_folder +
                                    plugin[0] + "/default.py"):

                                control = imp.load_source(
                                    "",
                                    config.base_root + config.plugins_folder +
                                    plugin[0] + "/default.py")

                                exec("ncontrol=control.Plugin(data)")
                                ncontrol.HEADERS = self.HEADERS

                                if data["args"][0].replace(
                                        "-", "_") in dir(ncontrol):
                                    exec("ncontrol." +
                                         data["args"][0].replace("-", "_") +
                                         "()")
                                else:
                                    exec("ncontrol.metodo_desconocido()")
                        """
						control=imp.load_source("",self.__path__+self.root.admin.settings.controller+".py")
						exec("ncontrol=control."+self.root.admin.settings.controller+"(data)")
						exec("ncontrol.metodo_desconocido()")
						"""
                    elif data["control"] == None:

                        control = imp.load_source(
                            "", self.__path__ +
                            self.root.admin.settings.controller + ".py")
                        exec("ncontrol=control." +
                             self.root.admin.settings.controller +
                             "(data,self.HEADERS)")
                        ncontrol.HEADERS = self.HEADERS

                    elif data["control"] != None:
                        control = imp.load_source(
                            "", self.__path__ +
                            self.root.admin.settings.controller + ".py")
                        exec("ncontrol=control." +
                             self.root.admin.settings.controller +
                             "(data,self.HEADERS)")

                        if data["control"] in dir(ncontrol):

                            exec("ncontrol." + data["control"] + "()")
                        else:

                            ncontrol.metodo_desconocido()
Пример #5
0
class Asenzor:
    """docstring for AsenZor"""
    def __init__(self):
        #====================================================================

        self.HEADERS = Headers()

        self.data = {"ajax": False}
        self.vista = "error404"

        self.data.update(getRest(config))

        import imp
        import cgi, cgitb
        cgitb.enable()

        data = cgi.FieldStorage()

        if (self.data["control"] == None
                and self.data['global_control'] == None
                and self.data['metodo'] == None and self.data['app'] == None
                and self.data['args'] == [] and self.data['request'] == {}
                and self.data['manager'] == False
                and self.data['ajax'] == False and self.data['kwargs'] == {}
                and self.data['action'] == None):
            self.data["app"] = config.default_app

        import os

        try:

            if type(data.value) == list:
                d = {}
                d2 = {}
                for elem in data.value:

                    if elem.name == "app":

                        if elem.value != "None" and elem.value != None:

                            self.data[elem.name] = normalizar(elem.value)

                            self.data["request"][elem.name] = elem

                    else:
                        if elem.name in d:
                            d[elem.name].append(elem.value)
                            d2[elem.name].append(elem)
                            self.data[elem.name] = d[elem.name]
                            self.data["request"][elem.name] = d2[elem.name]
                        else:
                            d[elem.name] = [elem.value]
                            d2[elem.name] = [elem]
                            self.data[elem.name] = normalizar(elem.value)
                            self.data["request"][elem.name] = elem

            else:
                """
		        params=data.value.split("/")[-1].split("&")


		        for elem in params:
		            k,v=elem.split("=")
		            self.data[k]=normalizar(v)                                                     
		            self.data["request"][k]={"value":normalizar(v)}                                                     
		        """

        except Exception, e:
            if "action" not in data:
                self.data["action"] = None
            else:
                self.data["action"] = data["action"].value
                self.data["request"]["action"] = data["action"]

        self.data["model"] = {}

        self.data["errores"] = []
        self.data["vars"] = {}

        self.data["plugins"] = {}

        self.data["login"] = False
        self.data["user"] = None
        self.data["isGlobalUser"] = False
        self.data["token"] = None
        self.data["model"]["global"] = model("../modelos/global",
                                             "../modelos/request/",
                                             "user",
                                             ext=".py")

        self.data["opciones"] = {
            "global": self.data["model"]["global"].obtenerFilas("Opciones")
        }
        self.data["plugins-hooks"] = []
        self.data["plugins"] = {}

        if self.data["app"] != None and self.data["global_control"] == None:

            sys.path.append(config.base_root + config.apps_folder +
                            self.data["app"] + "/")

            from app import app

            self.app = app()

            sys.path.append(self.app.admin.__path__) if (
                self.app.admin.__path__ not in sys.path) else None

            self.data["base_url"] = self.app.user.__url__

            contenido = self.data["model"]["global"].obtenerContenido(
                self.data["app"], "apps")[self.data["app"]]

            settings = self.app.admin.settings

            routes = self.app.admin.routes
            base_root = self.app.admin.__path__

            #=======================================================================

            if len(contenido) > 1 and self.data["app"] != None:

                for k, elem in enumerate(contenido[1]):

                    if contenido[1][elem]["value"] in settings.dbs:

                        if os.path.exists(self.app.admin.modelos.__path__ +
                                          str(contenido[1][elem]["value"]) +
                                          "_model.py"):
                            exec("model" + str(k) + "=imp.load_source('model" +
                                 str(k) + "' ,'" +
                                 self.app.admin.modelos.__path__ +
                                 str(contenido[1][elem]["value"]) +
                                 "_model.py').model")

                            exec("self.data['model']['" +
                                 contenido[1][elem]["value"] + "']=model" +
                                 str(k) + "('" +
                                 self.app.admin.modelos.__path__ +
                                 contenido[1][elem]["value"] + "','" +
                                 self.app.admin.modelos.__path__ +
                                 "request/','" + self.data["app"] +
                                 "',ext='.py')")

                            self.data["model"][
                                contenido[1][elem]["value"]].models[
                                    "global"] = self.data["model"]["global"]
                            self.data["model"]["global"].models[contenido[1][
                                elem]["value"]] = self.data["model"][
                                    contenido[1][elem]["value"]]

                            if "Opciones" in self.data["model"][
                                    contenido[1][elem]["value"]].db.tablas:
                                self.data["opciones"][contenido[1][elem][
                                    "value"]] = self.data["model"][
                                        contenido[1][elem]
                                        ["value"]].obtenerFilas("Opciones")
                            if self.data["model"][contenido[1][elem]
                                                  ["value"]].errores != []:
                                self.data["errores"].append(self.data["model"][
                                    contenido[1][elem]["value"]].errores)
                            elif self.data["model"][contenido[1][elem]
                                                    ["value"]].db.errores:
                                self.data["errores"].append(self.data["model"][
                                    contenido[1][elem]["value"]].db.errores)
                    else:
                        self.data["errores"].append(
                            "No se encontro el modelo: " +
                            contenido[1][elem]["value"] + " en el directorio")

                for k, elem in enumerate(contenido[2]):

                    if contenido[2][elem]["value"] in settings.dbs:
                        if os.path.exists("../" + config.modelos_folder +
                                          str(contenido[2][elem]["value"]) +
                                          "_model.py"):

                            exec("model" + str(k) + "=imp.load_source('model" +
                                 str(k) + "' ,'../" + config.modelos_folder +
                                 str(contenido[2][elem]["value"]) +
                                 "_model.py').model")
                            exec("self.data['model']['" +
                                 contenido[2][elem]["value"] + "']=model" +
                                 str(k) + "('" + base_root +
                                 routes.models_folder +
                                 contenido[2][elem]["value"] + "','" +
                                 base_root + routes.models_folder +
                                 "request/','" + self.data["app"] +
                                 "',ext='.py')")
                            self.data["model"][
                                contenido[2][elem]["value"]].models[
                                    "global"] = self.data["model"]["global"]
                            self.data["model"]["global"].models[contenido[2][
                                elem]["value"]] = self.data["model"][
                                    contenido[2][elem]["value"]]
                            if "Opciones" in self.data["model"][
                                    contenido[2][elem]["value"]].db.tablas:
                                self.data["opciones"][contenido[2][elem][
                                    "value"]] = self.data["model"][
                                        contenido[2][elem]
                                        ["value"]].obtenerFilas("Opciones")
                            if self.data["model"][contenido[2][elem]
                                                  ["value"]].errores != []:
                                self.data["errores"].append(self.data["model"][
                                    contenido[2][elem]["value"]].errores)
                            elif self.data["model"][contenido[2][elem]
                                                    ["value"]].db.errores:
                                self.data["errores"].append(self.data["model"][
                                    contenido[2][elem]["value"]].db.errores)
                        else:
                            self.data["errores"].append(
                                "No se encontro el modelo: " +
                                contenido[2][elem]["value"] +
                                " en el directorio")

            plugins = {}

            self.data["base_url"] = self.app.user.__url__

            for elem in self.data["model"]["main"].obtenerFilas("Plugins"):
                plugins[elem[0]] = elem[1]

            for plugin in self.data["model"]["global"].obtenerFilas("Plugins"):

                if plugin[0] in plugins:

                    if plugins[plugin[0]] == True:

                        for elem in plugin[1][1]:
                            self.data["plugins-hooks"].append(
                                [elem["name"], elem["value"]])

                        if os.path.exists(config.base_root +
                                          config.plugins_folder + plugin[0] +
                                          "/default.py"):

                            self.data["plugins"][plugin[0]] = imp.load_source(
                                "", config.base_root + config.plugins_folder +
                                plugin[0] + "/default.py").Plugin(self.data)

                        else:

                            print "El plugin: " + plugin[
                                0] + "No puede ser inicializado"

                else:

                    if self.data["model"]["main"].request():
                        self.data["model"]["main"].db("Plugins").insertar(
                            plugin[0], False)
                        self.data["model"]["main"].grabar()

            self.app.user.cnt(self.data)

        else:

            if self.data["app"] != None:
                sys.path.append(config.base_root + config.apps_folder +
                                self.data["app"] + "/")
                from app import app
                self.app = app()
                sys.path.append(self.app.admin.__path__) if (
                    self.app.admin.__path__ not in sys.path) else None
                self.data["base_url"] = self.app.user.__url__
                from settings import config as settings
                from settings import routes
                base_root = self.app.admin.__path__

                contenido = self.data["model"]["global"].obtenerContenido(
                    self.data["app"], "apps")[self.data["app"]]
                if len(contenido) > 1:
                    for k, elem in enumerate(contenido[1]):

                        if contenido[1][elem]["value"] in settings.dbs:

                            exec("model" + str(k) + "=imp.load_source('model" +
                                 str(k) + "' ,'" +
                                 self.app.admin.modelos.__path__ +
                                 str(contenido[1][elem]["value"]) +
                                 "_model.py').model")

                            exec("self.data['model']['" +
                                 contenido[1][elem]["value"] + "']=model" +
                                 str(k) + "('" +
                                 self.app.admin.modelos.__path__ +
                                 contenido[1][elem]["value"] + "','" +
                                 self.app.admin.modelos.__path__ +
                                 "request/','" + self.data["app"] +
                                 "',ext='.py')")

                            self.data["model"][
                                contenido[1][elem]["value"]].models[
                                    "global"] = self.data["model"]["global"]
                            self.data["model"]["global"].models[contenido[1][
                                elem]["value"]] = self.data["model"][
                                    contenido[1][elem]["value"]]

                            if "Opciones" in self.data["model"][
                                    contenido[1][elem]["value"]].db.tablas:
                                self.data["opciones"][contenido[1][elem][
                                    "value"]] = self.data["model"][
                                        contenido[1][elem]
                                        ["value"]].obtenerFilas("Opciones")
                            if self.data["model"][contenido[1][elem]
                                                  ["value"]].errores != []:
                                self.data["errores"].append(self.data["model"][
                                    contenido[1][elem]["value"]].errores)
                            elif self.data["model"][contenido[1][elem]
                                                    ["value"]].db.errores:
                                self.data["errores"].append(self.data["model"][
                                    contenido[1][elem]["value"]].db.errores)
                    for k, elem in enumerate(contenido[2]):

                        if contenido[2][elem]["value"] in settings.dbs:

                            exec("model" + str(k) + "=imp.load_source('model" +
                                 str(k) + "' ,'../" + config.modelos_folder +
                                 str(contenido[2][elem]["value"]) +
                                 "_model.py').model")
                            exec("self.data['model']['" +
                                 contenido[2][elem]["value"] + "']=model" +
                                 str(k) + "('" + base_root +
                                 routes.models_folder +
                                 contenido[2][elem]["value"] + "','" +
                                 base_root + routes.models_folder +
                                 "request/','" + self.data["app"] +
                                 "',ext='.py')")
                            self.data["model"][
                                contenido[2][elem]["value"]].models[
                                    "global"] = self.data["model"]["global"]
                            self.data["model"]["global"].models[contenido[2][
                                elem]["value"]] = self.data["model"][
                                    contenido[2][elem]["value"]]

                            if "Opciones" in self.data["model"][
                                    contenido[2][elem]["value"]].db.tablas:
                                self.data["opciones"][contenido[2][elem][
                                    "value"]] = self.data["model"][
                                        contenido[2][elem]
                                        ["value"]].obtenerFilas("Opciones")
                            if self.data["model"][contenido[2][elem]
                                                  ["value"]].errores != []:
                                self.data["errores"].append(self.data["model"][
                                    contenido[2][elem]["value"]].errores)
                            elif self.data["model"][contenido[2][elem]
                                                    ["value"]].db.errores:
                                self.data["errores"].append(self.data["model"][
                                    contenido[2][elem]["value"]].db.errores)

            if self.data["manager"] == True and gringolizar(
                    self.data["global_control"]) in config.controladores:

                if self.data["global_control"] == "Plugin":
                    for plugin in self.data["model"]["global"].obtenerFilas(
                            "Plugins"):

                        for elem in plugin[1][1]:
                            self.data["plugins-hooks"].append(
                                [elem["name"], elem["value"]])

                        self.data["plugins"][plugin[0]] = imp.load_source(
                            "", config.base_root + config.plugins_folder +
                            plugin[0] + "/default.py").Plugin(self.data)

                control = imp.load_source(
                    "", config.base_root + config.controller_folder +
                    "Controladores/" +
                    gringolizar(self.data["global_control"]) + ".py")

                exec("control=control." +
                     gringolizar(self.data["global_control"]) + "(self.data)")

                if self.data["metodo"] != None and self.data["metodo"] in dir(
                        control):

                    exec("control." + gringolizar(self.data["metodo"]) + "()")
                """
				Pendiente ya que plugin no lo utilizaria ya que el metodo desconocido des del plugin que carga no del global_control
				elif self.data["metodo"]!=None:
					
					exec("control.metodo_desconocido()")
				"""

            else:
                self.HEADERS.show()

                from modulos.ztec.intervalor.control import generar2
                generar2(
                    config.base_root + config.vistas_folder + self.vista +
                    ".html", config.base_root + config.vistas_folder +
                    config.templates_folder + self.vista + ".py",
                    "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n")
                doc = ""
                f = open(
                    config.base_root + config.vistas_folder +
                    config.templates_folder + self.vista + ".py", "r")
                script = f.read()
                exec(script)
                print doc
Пример #6
0
    def Galeria(self):
        """
		Este metodo se usa para crear o modificar una pagina en espacifico
		"""
        from modulos.ztec.zred import normalizar, gringolizar, redirecter

        if self.data["ajax"] == False:
            if self.data["action"] == "editar":
                #self.HEADERS.set_headers({"Content-type":"text/plain\n"})
                self.HEADERS.show()

                self.data["repeate"] = 1
                self.data["plantillas"] = self.model["main"].obtenerFilas(
                    "Plantillas")

                keys = self.data["args"][1]

                i = self.data["args"][2]

                self.data["categorias"] = {}

                self.data["titulo"] = self.data["metodo"]

                if i != None:
                    self.data["categorias"] = {}

                    tabla = self.model["galerias"].obtenerFilas("Galerias")[i]

                    self.data["titulo"] = tabla[0]

                    self.data["meta-layout"] = self.data["model"][
                        "paginas"].exportarMetadato(tabla[4], "layout")
                    self.data["meta-control"] = self.data["model"][
                        "paginas"].exportarMetadato(tabla[4], "control")

                    self.data["post"] = ""
                    self.data["control-post"] = gringolizar(
                        self.data["titulo"], "-")

                    l1 = self.data["plugins"][plugin_settings.name].model[
                        "galerias"].obtenerFilas("Galerias")[i][1]
                    self.data["boxes"] = [l1]
                    self.data["vars"] = {
                        "titulos": [],
                        "actual": self.data["titulo"]
                    }

                    for elem in self.data["plugins"][
                            plugin_settings.
                            name].model["galerias"].obtenerFilas("Galerias"):
                        self.data["vars"]["titulos"].append(elem[0])

                else:
                    self.data["titulo"] = "Crea una nueva pagina"
                    self.data["meta-layout"] = self.data["titulo"]
                    self.data["post"] = gringolizar(self.data["titulo"], "-")
                    self.data["control-post"] = "Inicio"
                    self.data["boxes"] = [
                        self.model["galerias"].obtenerEstructura("Galerias")[1]
                    ]

                modelos = self.data["model"]["main"].obtenerFilas(
                    'Tablas,args>Modelos')[0][0]
                tablas = self.data["model"]["main"].obtenerFilas(
                    'args>Tablas')[0][0]

                self.data["vars"]["modelos"] = modelos
                self.data["vars"]["opciones"] = self.data["opciones"]
                self.data["vars"]["Tablas"] = tablas

            elif self.data["action"] == "save":
                #self.HEADERS.set_headers({"Content-type":"text/plain\n"})
                self.HEADERS.show()

                if self.data["args"][2] != None:

                    self.model["galerias"].modificarGaleria(
                        self.data["args"][2], self.data["request"],
                        self.data["metadatos"])
                    redirecter(config,
                               settings.app,
                               "admin",
                               "Plugin",
                               plugin_settings.name,
                               "Galerias",
                               action="listar")()
                else:

                    self.model["galerias"].crearGaleria(
                        self.data["request"], self.data["metadatos"])

                    redirecter(config,
                               settings.app,
                               "admin",
                               "Plugin",
                               plugin_settings.name,
                               "Galeria",
                               self.data["args"][2],
                               action="listar")()
Пример #7
0
    def Shortcode(self):
        """
		Este metodo se usa para crear o modificar una pagina en espacifico
		"""
        from modulos.ztec.zred import normalizar, gringolizar, redirecter

        if self.data["ajax"] == False:
            if self.data["action"] == "editar":
                #self.HEADERS.set_headers({"Content-type":"text/plain\n"})
                self.HEADERS.show()

                self.data["repeate"] = 1
                self.data["plantillas"] = self.model["main"].obtenerFilas(
                    "Plantillas")

                keys = self.data["args"][1]

                i = self.data["args"][2]
                self.data["categorias"] = {}

                self.data["titulo"] = self.data["metodo"]

                if i != None:
                    self.data["categorias"] = {}

                    tabla = self.model["shortcodes"].obtenerFilas(
                        "Shortcodes")[i]

                    self.data["titulo"] = tabla[0]

                    self.data["meta-layout"] = self.data["model"][
                        "paginas"].exportarMetadato(tabla[4], "layout")
                    self.data["meta-control"] = self.data["model"][
                        "paginas"].exportarMetadato(tabla[4], "control")

                    self.data["post"] = ""
                    self.data["control-post"] = gringolizar(
                        self.data["titulo"], "-")

                    l1 = self.data["plugins"][plugin_settings.name].model[
                        "shortcodes"].obtenerFilas("Shortcodes")[i][1]
                    self.data["boxes"] = [l1]
                    self.data["vars"] = {
                        "titulos": [],
                        "actual": self.data["titulo"]
                    }

                    for elem in self.data["plugins"][
                            plugin_settings.name].model[
                                "shortcodes"].obtenerFilas("Shortcodes"):
                        self.data["vars"]["titulos"].append(elem[0])

                else:
                    self.data["titulo"] = "Crea una nueva pagina"
                    self.data["meta-layout"] = self.data["titulo"]
                    self.data["post"] = gringolizar(self.data["titulo"], "-")
                    self.data["control-post"] = "Inicio"
                    self.data["boxes"] = [
                        self.model["shortcodes"].obtenerEstructura(
                            "Shortcodes")[1]
                    ]

                modelos = self.data["model"]["main"].obtenerFilas(
                    'Tablas,args>Modelos')[0][0]
                tablas = self.data["model"]["main"].obtenerFilas(
                    'args>Tablas')[0][0]

                self.data["vars"]["modelos"] = modelos
                self.data["vars"]["opciones"] = self.data["opciones"]
                self.data["vars"]["Tablas"] = tablas

            elif self.data["action"] == "save":
                #self.HEADERS.set_headers({"Content-type":"text/plain\n"})
                self.HEADERS.show()
                titulo = self.data["request"]["titulo"].value.strip(
                )[self.data["request"]["titulo"].value.strip().find("-") + 1:]
                f = open(
                    plugin_settings.__path__ +
                    plugin_settings.shortcodes_folder + titulo + ".py", "w")
                f.write(decode(self.data["request"]["controlador"].value))
                f.close()
                f = open(
                    plugin_settings.__path__ + plugin_settings.widgets_folder +
                    titulo + ".html", "w")
                f.write(decode(self.data["request"]["layout"].value))
                f.close()

                if self.data["args"][2] != None:

                    self.model["shortcodes"].modificarShortcode(
                        self.data["args"][2], self.data["request"],
                        self.data["metadatos"])
                    redirecter(config,
                               settings.app,
                               "admin",
                               "Plugin",
                               plugin_settings.name,
                               "Shortcode",
                               str(self.data["args"][2]),
                               action="editar")()
                else:
                    self.model["shortcodes"].crearShortcode(
                        self.data["request"], self.data["metadatos"])

                    redirecter(config,
                               settings.app,
                               "admin",
                               "Plugin",
                               plugin_settings.name,
                               "Shortcode",
                               str(self.data["args"][2]),
                               action="editar")()