def create(self, **kw): adjuntos = Adjuntos() #save the filename to the database #adjuntos.idItem= kw['idItem'] adjuntos.picture_filename = kw['adjuntos_filename'].filename #DBSession.add(adjuntos) DBSession.flush() """#write the picture file to the public directory adjuntos_path = os.path.join(adjuntos_dirname, str(adjuntos.id)) try: os.makedirs(adjuntos_path) except OSError: #ignore if the folder already exists pass adjuntos_path = os.path.join(adjuntos_path, adjuntos.adjuntos_filename) f = file(adjuntos_path, "w") f.write(kw['adjuntos_filename'].value) f.close() """ #flash("adjuntos was successfully created.") redirect("./adjuntos")