def load_from_web(self, form): try: self.name = form['name'] self.cnpj = load_int(['cnpj']) self.phone = load_int_as_str(['phone']) self.active = 'active' in form except BadRequestKeyError as ke: abort(403)
def load_from_web(self, form, files): try: self.department = Department() self.enterprise = Enterprise() self.role = Role() self.name = form['name'] self.department.load(int(form['departament'])) self.enterprise.load(int(form['enterprise'])) self.role.load(int(form['role'])) self.registry = load_int(form['registry']) self.name_tag = load_int(form['name_tag']) self.active = form['active'] == 'Y' self.cpf = load_int(form['cpf']) self.sex = nwe(form['sex']) self.rg = nwe(form['rg']) self.rg_issuing = nwe(form['rg_issuing']) self.rg_date = nwe(form['rg_date']) self.born_date = load_date(form['born_date']) self.cnh = nwe(form['cnh']) self.cnh_category = nwe(form['cnh_category']) self.ctps = nwe(form['ctps']) self.ctps_series = nwe(form['ctps_series']) self.ctps_fu = nwe(form['ctps_fu']) self.ctps_date = nwe(form['ctps_date']) self.nacionality = nwe(form['nacionality']) self.place_of_birth = nwe(form['place_of_birth']) self.phone = load_int_as_str(form['phone']) self.cellphone = load_int_as_str(form['cellphone']) self.zipcode = load_int_as_str(form['zipcode']) self.address = nwe(form['address']) self.address_adjunct = nwe(form['address_adjunct']) self.neighborhood = nwe(form['neighborhood']) self.city = nwe(form['city']) self.fu = nwe(form['fu']) self.father_name = nwe(form['father_name']) self.mother_name = nwe(form['mother_name']) self.scholarity = load_int(form['scholarity']) self.scholarity_complete = form['scholarity_complete'] == 'Y' self.graduation = nwe(form['graduation']) self.post_graduation = nwe(form['post_graduation']) self.civil_state = nwe(form['civil_state']) self.spouse = nwe(form['spouse']) self.admission_date = load_date(form['admission_date']) self.demission_date = load_date(form['demission_date']) self.pis_date = load_date(form['pis_date']) self.pis_number = load_int(form['pis_number']) self.meal_on_enterprise = form['meal_on_enterprise'] == 'Y' self.salary = load_decimal(form['salary']) self.reservist = nwe(form['reservist']) self.bank = nwe(form['bank']) self.agency = nwe(form['agency']) self.account = nwe(form['account']) self.winthor_registry = load_int(form['winthor_registry']) self.transport_voucher = form['transport_voucher'] == 'Y' data = files['photo'].stream.read() if data != b'': self.photo = data except BadRequestKeyError: abort(403)