def new_connection(self):
     print "========== Create a new connection ================"
     aux = Conector()
     aux.proyecto_id = self.element_id
     aux.tipo = 1
     
     has_error = True
     host = ""
     while has_error:
         host = raw_input("[Host] > ")
         if host != "":
             has_error = False
     aux.host = host
     
     has_error = True
     port = ""
     while has_error:
         port = raw_input("[Port] > ")
         if port != "":
             has_error = False
     aux.port = port
     
     has_error = True
     user = ""
     while has_error:
         user = raw_input("[User] > ")
         if user != "":
             has_error = False
     aux.user = user
     
     has_error = True
     password = ""
     while has_error:
         password = raw_input("[Password] > ")
         if password != "":
             has_error = False
     aux.password = password
     
     
     schema = ""
     schema = raw_input("[Schema] > ")
     aux.schema = schema
     
     has_error = True
     master = 0
     while has_error:
         try:
             aux_master = raw_input("[Master] > ")
             master = int(aux_master)
             if master == 0 or master == 1:
                 has_error = False
         except ValueError:
             print "It has to be a number" 
     aux.master = master
     
     aux.id = self.conector_db.insert_element(aux)
     return True
    def new_connection(self):
        print "========== Create a new connection ================"
        aux = Conector()
        aux.proyecto_id = self.element_id
        aux.tipo = 1

        has_error = True
        host = ""
        while has_error:
            host = raw_input("[Host] > ")
            if host != "":
                has_error = False
        aux.host = host

        has_error = True
        port = ""
        while has_error:
            port = raw_input("[Port] > ")
            if port != "":
                has_error = False
        aux.port = port

        has_error = True
        user = ""
        while has_error:
            user = raw_input("[User] > ")
            if user != "":
                has_error = False
        aux.user = user

        has_error = True
        password = ""
        while has_error:
            password = raw_input("[Password] > ")
            if password != "":
                has_error = False
        aux.password = password

        schema = ""
        schema = raw_input("[Schema] > ")
        aux.schema = schema

        has_error = True
        master = 0
        while has_error:
            try:
                aux_master = raw_input("[Master] > ")
                master = int(aux_master)
                if master == 0 or master == 1:
                    has_error = False
            except ValueError:
                print "It has to be a number"
        aux.master = master

        aux.id = self.conector_db.insert_element(aux)
        return True
 def hidratateObject(self, row):
     aux = Conector()
     aux.id = row["id"]
     aux.proyecto_id = row["proyecto_id"]
     aux.tipo = row["tipo"]
     aux.host = row["host"]
     aux.port = row["port"]
     aux.user = row["user"]
     aux.password = row["password"]
     aux.schema = row["schema"]
     aux.master = row["master"]
     return aux
 def hidratateObject(self, row):
     aux = Conector()
     aux.id = row["id"]
     aux.proyecto_id = row["proyecto_id"]
     aux.tipo = row["tipo"]
     aux.host = row["host"]
     aux.port = row["port"]
     aux.user = row["user"]
     aux.password = row["password"]
     aux.schema = row["schema"]
     aux.master = row["master"]
     return aux