Exemplo n.º 1
0
    def createContainer(self, form):

        db = self.__db
        cursor = self.__cursor
        hostname = self.__hostname

        lHandler = LocationHandler(db, cursor)

        # some form values may be blank, so initialize as empty
        contName = ""
        contDesc = ""

        if form.has_key("cont_cont_name_field"):
            contName = form.getvalue("cont_cont_name_field")

        if form.has_key("cont_cont_desc_field"):
            contDesc = form.getvalue("cont_cont_desc_field")

        # container type and size are selected from a list, so they can't be empty
        contTypeID = form.getvalue("cont_cont_group_selection")
        contSize = form.getvalue("cont_cont_type_selection")

        # laboratory - always selected by default
        contLab = form.getvalue("labs")

        # Location - fridge, freezer, LN tank, etc.
        storage_type = form.getvalue("storage_type")
        storage_name = form.getvalue("storage_name")
        cont_row = form.getvalue("cont_row")
        cont_col = form.getvalue("cont_col")
        cont_rack = form.getvalue("cont_rack")
        cont_shelf = form.getvalue("cont_shelf")
        storage_address = form.getvalue("storage_address")

        newContID = lHandler.insertContainer(contTypeID, contSize, contName,
                                             contDesc, contLab, storage_type,
                                             storage_name, storage_address,
                                             cont_shelf, cont_rack, cont_row,
                                             cont_col)

        utils.redirect(hostname + "Location.php?View=6&Sub=3&Mod=" +
                       ` newContID `)