Example #1
0
    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)
Example #2
0
    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)
Example #3
0
 def load_from_web(self, form):
     try:
         self.name = form['name']
         self.born_date = load_date(form['born_date'])
         self.kinship = form['kinship']
     except BadRequestKeyError:
         abort(403)
Example #4
0
 def load_from_web(self, form):
     try:
         self.name = form['name']
         self.born_date = load_date(form['born_date'])
         self.kinship = form['kinship']
     except BadRequestKeyError:
         abort(403)
Example #5
0
 def load_from_web(self, form):
     try:
         self.date = load_date(form['date'])
         self.type = nwe(form['type'])
         self.conclusion = form['conclusion'] == 'Y'
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError as ke:
         abort(403)
Example #6
0
 def load_from_web(self, form):
     try:
         self.date = load_date(form['date'])
         self.type = nwe(form['type'])
         self.conclusion = form['conclusion'] == 'Y'
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError as ke:
         abort(403)
Example #7
0
 def load_from_web(self, txt, value):
     tmp = txt.split('_')
     tmp2 = tmp[3].split('.')
     this_date = load_date(tmp2[2], fmt='%d.%m.%Y')
     registry = int(tmp[2])
     qry = Query(self)
     qry.get(date=this_date, registry=registry, result_type=T_DICT)
     if len(qry) > 0:
         self.load_data(qry[0])
     try:
         self.date = this_date
         self.registry = registry
         self.has_meal = value == 'Y'
     except BadRequestKeyError as ke:
         abort(403)
Example #8
0
 def load_from_web(self, txt, value):
     tmp = txt.split('_')
     tmp2 = tmp[3].split('.')
     this_date = load_date(tmp2[2], fmt='%d.%m.%Y')
     registry = int(tmp[2])
     qry = Query(self)
     qry.get(date=this_date, registry=registry, result_type=T_DICT)
     if len(qry) > 0:
         self.load_data(qry[0])
     try:
         self.date = this_date
         self.registry = registry
         self.has_meal = value == 'Y'
     except BadRequestKeyError as ke:
         abort(403)
Example #9
0
 def load_from_web(self, form):
     try:
         self.type = int(form['type'])
         self.date = load_date(form['date'])
         self.reason = int(form['reason'])
         self.requester = form['requester']
         self.witness1 = nwe(form['witness1'])
         self.witness2 = nwe(form['witness2'])
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError:
         abort(403)
Example #10
0
 def load_from_web(self, form):
     try:
         self.type = int(form['type'])
         self.date = load_date(form['date'])
         self.reason = int(form['reason'])
         self.requester = form['requester']
         self.witness1 = nwe(form['witness1'])
         self.witness2 = nwe(form['witness2'])
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError:
         abort(403)
Example #11
0
 def load_from_web(self, form):
     try:
         self.relative_start = load_date(form['relative_start'])
         self.relative_end = load_date(form['relative_end'])
         self.use_start = load_date(form['use_start'])
         self.use_end = load_date(form['use_end'])
         self.allowance_start = load_date(form['allowance_start'])
         self.allowance_end = load_date(form['allowance_end'])
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError:
         abort(403)
Example #12
0
 def load_from_web(self, form):
     try:
         self.relative_start = load_date(form['relative_start'])
         self.relative_end = load_date(form['relative_end'])
         self.use_start = load_date(form['use_start'])
         self.use_end = load_date(form['use_end'])
         self.allowance_start = load_date(form['allowance_start'])
         self.allowance_end = load_date(form['allowance_end'])
         self.observations = nwe(form['observations'])
         self.document_ext = replace_when_none(
             nwe(form['document_filename'].split('.')[-1]),
             self.document_ext)
         if len(form['document']) > 0:
             self.document = b64decode(
                 form['document'].split(';base64,')[1].encode())
     except BadRequestKeyError:
         abort(403)