def parse(self, candidate): xpath_ = "//*[@id='ctl00_ContentPlaceHolder1_NameInfo1_dlDOIs']/tbody/tr[@class!='gridviewheader']" tree = html.fromstring(self.page_content) # Body being generated with this xpath is empty list. body = tree.xpath(xpath_) dropdowns_list = [] candidates_list = [] offices_list = [] # This condition is specifically to handle Account, Deleted profiles. if not body: candidate['FilerId'] = 'No filer ID' candidate['CandidateStatus'] = 0 candidate['ElectionType'] = 0 candidate['ElectionYear'] = 0 return [(None, Office(Name='No Office.'), candidate)] for tr in body: try: candidate_copy = copy.copy(candidate) filer = tr.xpath('.//td[1]/text()').pop() office_name = tr.xpath('.//td[2]/span/text()').pop() dropdown = tr.xpath('.//td[3]/a/@id').pop() status = tr.xpath('.//td[4]/span/text()').pop() dropdowns_list.append(dropdown) candidate_copy['FilerId'] = filer candidate_copy['CandidateStatus'] = self.status_to_int(status) candidates_list.append(candidate_copy) office = Office(Name=office_name) offices_list.append(office) except Exception as e: logging.info(e) return ((dropdown, office, candidate) for dropdown, office, candidate in zip(dropdowns_list, offices_list, candidates_list))
def import_offices(): Office.objects.all().delete() ds = DataSource('wfp/gis/data/wld_poi_facilities_wfp.shp') print(ds) lyr = ds[0] print lyr.fields # 'wfpid', u'place', u'facility', u'status', u'iso3', u'iso3_op', u'country' # u'locprecisi', u'latitude', u'longitude', u'wfpregion', u'nat_staff', # u'int_staff', u'lastcheckd', u'remarks', u'source', u'createdate', # u'updatedate', u'objectidol', u'precisiono', u'verifiedol' for feat in lyr: geom = feat.geom pnt = GEOSGeometry(geom.ewkt) wfpid = feat.get('wfpid') place = feat.get('place') facility = feat.get('facility') status = feat.get('status') country = feat.get('country') wfpregion = feat.get('wfpregion') lastcheckd = feat.get('lastcheckd') createdate = feat.get('createdate') updatedate = feat.get('updatedate') source = feat.get('source') office = Office(geom=pnt, wfpid=wfpid, place=place, facility=facility, wfpregion=wfpregion, lastcheckd=lastcheckd, source=source, status=status, country=country, createdate=createdate, updatedate=updatedate) office.save()
def parse(self): xpath_ = "//*[@id='ctl00_ContentPlaceHolder1_NameInfo1_dlDOIs']/tbody/tr[@class!='gridviewheader']" tree = html.fromstring(self.page_content) # Body being generated with this xpath is empty list. body = tree.xpath(xpath_) dropdown_links = [] offices = [] if not body: return [(None, None)] for tr in body: try: filer_id = tr.xpath('.//td[1]/text()').pop() office_sought = tr.xpath('.//td[2]/span/text()').pop() dropdown_link = tr.xpath('.//td[3]/a/@id').pop() logging.info(f'Dropdown link: {dropdown_link}') status = tr.xpath('.//td[4]/span/text()').pop() office = Office(filer_id=filer_id, office_sought=office_sought, status=status) offices.append(office) dropdown_links.append(dropdown_link) except Exception as e: logging.info(e) return ((dropdown_link, office) for dropdown_link, office in zip(dropdown_links, offices))
def dict_data(self): data = [ (scp.immatricule, scp.denomination, scp.commercial_name, scp.created_date, scp.display_activity(), scp.display_spinneret(), scp.display_forme(), int(scp.apports_numeraire) + int(scp.apports_nature) + int(scp.apports_industrie), scp.apports_numeraire, scp.apports_nature, scp.apports_industrie, scp.display_cercle(), scp.display_commune(), scp.display_vfq(), scp.rue, scp.porte, scp.tel, scp.bp, scp.email, scp.duree_statutaire) for scp in self.qs ] ofiice = Office.get(Office.id == 1) title = "SCOOP de {}".format(ofiice.cercle_name()) hheaders = [ "Immatricule", "Dénomination Sociale de la société coopérative", "Nom Commercial / Sigle / Enseigne", "Année de création de la société coopérative", "Activités exercées", "Filière", "Forme de la société coopérative", "Montant total", "Montant apports en numéraire", "Montant apports en nature", "Montant apports en industrie", "Cercle", "Commune", "Village/Fraction/Quartier", "Rue", "Porte", "Tel", "BP", "E-mail", "Durée statutaire de la société coopérative", ] return { 'file_name': title, 'headers': hheaders, 'data': data, "extend_rows": [], 'sheet': title, 'widths': self.stretch_columns, 'format_money': [ "H:H", "I:I", "J:J", ], # 'exclude_row': len(self.data) - 1, # 'date': self.parent.now, 'others': [("A5", "C5", "DRDSES : {}".format(ofiice.region_name())), ("A6", "B6", "SLDSES: {}".format(ofiice.cercle_name()))], }
def obc_form(request, citizen_id=None, aadhaar_number=None): if request.method == "POST": obc_form_response = OBCFormResponse() obc_form = OBCFormForm(request.POST, instance=obc_form_response) if obc_form.is_valid(): case = Case() case.office = Office.first() case.sms_selected = False case.robo_call_selected = False case.follow_up_selected = False office_visit = OfficeVisit() if citizen_id != None: citizen = Citizen.objects.get(pk = citizen_id) case.citizen = citizen case.save() office_visit.citizen = citizen office_visit.case = case office_visit.save() else: user = Citizen() citizen = CitizenForm(request.POST, instance=user) if citizen.is_valid(): citizen = citizen.save() case.citizen = citizen case.save() office_visit.citizen = citizen office_visit.case = case office_visit.save() obc_form = obc_form.save(commit=False) obc_form.citizen = citizen obc_form.office_visit = office_visit obc_form.save() return HttpResponseRedirect(reverse('aadhaar_lookup')) if request.method == "GET": obc_form = OBCFormForm() citizen_form = CitizenForm(initial={'aadhaar_number': aadhaar_number}) inputFilter = ["Caste Serial Number", "Name of Father", "Name of Mother", "Male Constitutional Posts", "Female Constitutional Posts","Male Start of Appointment", "Male End of Appointment","Female Start of Appointment", "Female End of Appointment"] if citizen_id != None: try: citizen = Citizen.objects.get(pk=citizen_id) context = {'obc_form': obc_form, 'citizen': citizen, 'citizen_form':citizen_form, 'inputFilter': inputFilter} return render(request, 'bribecaster/OBC_form.html', context) except Exception as e: pass citizen = None context = {'obc_form': obc_form, 'citizen': citizen, 'citizen_form':citizen_form, 'inputFilter': inputFilter} return render(request, 'bribecaster/OBC_form.html', context)
def setUp(self): """Make sure we start with a clean slate""" db.drop_all() db.create_all() Office.query.delete() District.query.delete() Representative.query.delete() User.query.delete() Interaction.query.delete() UserRepresentative.query.delete() test_office = Office(phone='123-555-1234', address='123 Test St.', location='district') test_district = District(state='ny', district_num='123', house='lower') db.session.add(test_office) db.session.add(test_district) db.session.commit() office = Office.query.get(1) district = District.query.get(1) test_rep = Representative(first_name='Testy', last_name='McTestface', full_name='Testy McTestface', photo_url='https://mn315.net/wp-content/uploads/2018/06/cropped-Ugandan-Knuckles.jpg', email='*****@*****.**', serving=True, district=district, websites=[ { "url": "http://www.google.com" }, { "url": "http://tesla.com" } ]) test_user = User.register(username='******', password='******', first_name='Some', last_name='User', email='*****@*****.**', address='123 Any St., Anytown NY 12345') # login_test = User.register(username='******', password='******', first_name='test', last_name='test', email='*****@*****.**', address='82 Kent Blvd., Salamanca NY 14779') db.session.add(test_rep) db.session.add(test_user) # db.session.add(login_test) db.session.commit() user = User.query.get(1) self.user = user # user2 = User.query.get(2) rep = Representative.query.get(1) user.representatives.append(rep) rep.offices.append(office) # user2.representatives.append(rep) db.session.commit() # import pdb # pdb.set_trace() test_interaction = Interaction(user=user, representative=rep, district=district, interaction_date='2020-07-15 10:00:00', medium='email', topic='stuff and junk', content='all the things') db.session.add(test_interaction) db.session.commit()
def save_offices(offices, doctor): """ :param offices: :param doctor: save Office object data to local database """ for office_data in offices: office = Office( id=office_data['id'], doctor=doctor, country=office_data['country'], state=office_data['state'], city=office_data['city'], address=office_data['address'], zip_code=office_data['zip_code'], ) office.save()
def update_data(self): print("update_data") if not internet_on(base_url): # print("Pas de d'internet !") return if Office().select().count() == 0: return lse = License().select().where(License.id == 1).get() if not lse.isactivated: print("is not activated") return office = Office().select().where(Office.id == 1).get() if not office.is_syncro: resp = self.sender("add-office", office.data()) if resp.get("save"): office.updated() for model in [ CooperativeCompanie, CooperativeMember, CheckList, Demande, Immatriculation ]: for m in model.all(): if not m.is_syncro: print("sending :", model) resp = self.sender("update-data", m.data()) # print("resp : ", resp) if resp.get("save"): m.updated()
def test_office_add(self): rep = Representative.add_rep(single_rep1) db.session.commit() o = Office.add_office(single_office) rep.offices.append(o) db.session.commit() testoffice = Office.query.get(1) # import pdb # pdb.set_trace() self.assertIsNotNone(testoffice) self.assertEqual(testoffice.phone, '716-664-4603') self.assertEqual( testoffice.address, '2-6 E. Second Street; Fenton Building, Suite 302; Jamestown, NY 14701' ) self.assertEqual(testoffice.location, 'District Office')
def setUp(self): self.office = Office('Office') self.male_room = Living('MaleRoom', 'MALE') self.female_room = Living('FemaleRoom', 'FEMALE') self.chidi = Staff('Chidi', 'm') self.seyi = Staff('Seyi', 'M') self.lady_seyi = Staff('Seyi', 'f') self.lade = Fellow('Lade', 'M') self.fisayo = Fellow('Fisayo', 'M') self.kate = Fellow('Kate', 'F') self.sayo = Fellow('Sayo', 'F') self.office.add_member(self.chidi) self.office.add_member(self.seyi) self.office.add_member(self.lady_seyi) self.male_room.add_member(self.lade) self.male_room.add_member(self.fisayo) self.female_room.add_member(self.sayo) self.female_room.add_member(self.kate)
class TestAmityModels(unittest.TestCase): def setUp(self): self.office = Office('Office') self.male_room = Living('MaleRoom', 'MALE') self.female_room = Living('FemaleRoom', 'FEMALE') self.chidi = Staff('Chidi', 'm') self.seyi = Staff('Seyi', 'M') self.lady_seyi = Staff('Seyi', 'f') self.lade = Fellow('Lade', 'M') self.fisayo = Fellow('Fisayo', 'M') self.kate = Fellow('Kate', 'F') self.sayo = Fellow('Sayo', 'F') self.office.add_member(self.chidi) self.office.add_member(self.seyi) self.office.add_member(self.lady_seyi) self.male_room.add_member(self.lade) self.male_room.add_member(self.fisayo) self.female_room.add_member(self.sayo) self.female_room.add_member(self.kate) def test_office_instance(self): self.assertIsInstance( self.office, Office, msg="office should be an instance of 'Office' class" ) def test_office_object_type(self): self.assertTrue( (type(self.office) is Office), msg="The object should be a type of 'Office'" ) def test_living_instance(self): self.assertIsInstance( self.male_room, Living, msg="living should be an instance of 'Living' class" ) def test_living_object_type(self): self.assertTrue( (type(self.female_room) is Living), msg="The object should be a type of 'Living space'" ) def test_staff_instance(self): self.assertIsInstance( self.chidi, Staff, msg="staff should be an instance of 'Staff' class" ) def test_staff_object_type(self): self.assertTrue( (type(self.chidi) is Staff), msg="The object should be a type of 'Staff'" ) def test_fellow_instance(self): self.assertIsInstance( self.lade, Fellow, msg="fellow should be an instance of 'Fellow' class" ) def test_fellow_object_type(self): self.assertTrue( (type(self.lade) is Fellow), msg="The object should be a type of 'Fellow'" ) def test_can_return_current_size_of_office(self): self.assertEquals(self.office.current_size( ), 3, msg="The function should return the current number of members in that office") def test_can_return_current_size_of_living(self): self.assertEquals(self.male_room.current_size( ), 2, msg="The function should return the current number of members in that living space") self.assertEquals(self.female_room.current_size( ), 2, msg="The function should return the current number of members in that living space")
Interaction, ) from app import app db.drop_all() db.create_all() Office.query.delete() District.query.delete() Representative.query.delete() User.query.delete() Interaction.query.delete() UserRepresentative.query.delete() test_office = Office(phone="123-555-1234", address="123 Test St.", location="district") test_district = District(state="ny", district_num="123", house="lower") db.session.add(test_office) db.session.add(test_district) db.session.commit() office = Office.query.get(1) district = District.query.get(1) test_rep = Representative( given_name="Testy", family_name="McTestface", name="Testy McTestface", image=
def __init__(self, parent=0, *args, **kwargs): super(RegistrationViewWidget, self).__init__(parent=parent, *args, **kwargs) self.parent = parent self.parentWidget().set_window_title("FORMULAIRE D’IMMATRICULATION") self.title = FLabel("<h3>FORMULAIRE D’IMMATRICULATION</h3>") self.office = Office.select().where(Office.id == 1).get() self.created_date_field = FormatDate(QDate.currentDate()) self.created_date_field.setMaximumWidth(130) # self.created_date_field.setInputMask('##/##/####') self.rue_field = IntLineEdit() self.porte_field = IntLineEdit() self.tel_field = IntLineEdit() self.tel_field.setInputMask('## ## ## ##') self.tel2_field = IntLineEdit() self.tel2_field.setInputMask('## ## ## ##') self.bp_field = IntLineEdit() self.email_field = LineEdit() self.denomination_field = LineEdit() self.commercial_name_field = LineEdit() self.declaration_date_field = FormatDate(QDate.currentDate()) self.declaration_date_field.setMaximumWidth(130) self.amount_capital_social_initial = FLabel() self.amount_part_social_field = IntLineEdit() self.apports_numeraire_field = IntLineEdit() self.apports_numeraire_field.textChanged.connect(self.cal_total) self.apports_nature_field = IntLineEdit() self.apports_nature_field.textChanged.connect(self.cal_total) self.apports_industrie_field = IntLineEdit() self.apports_industrie_field.textChanged.connect(self.cal_total) self.duree_statutaire_field = IntLineEdit() self.duree_statutaire_field.setMaximumWidth(80) self.spinneret_box = QComboBox() self.spinneret_box.setMaximumWidth(800) self.activites_box = QComboBox() self.activites_box.setMaximumWidth(800) self.activites_box.currentIndexChanged.connect(self.sp_change_select) self.activities_list = get_activities() for index, value in enumerate(self.activities_list): self.activites_box.addItem( "{}".format(self.activities_list.get(value).upper()), value) # if self.store and self.store.name == op.name: # self.box_store.setCurrentIndex(index) self.formes_box = QComboBox() self.formes_box.setMaximumWidth(800) self.formes_list = get_formes() for index, value in enumerate(self.formes_list): self.formes_box.addItem( "{}".format(self.formes_list.get(value).upper()), value) self.commune_list = entity_children(self.office.slug_cercle).items() self.commune_box = ExtendedComboBox() for index, value in enumerate(self.commune_list): self.commune_box.addItem("{}".format(value[1].upper()), value[0]) # self.commune_box.addItems(self.commune_list) self.commune_box.setToolTip("commune") self.commune_box.currentIndexChanged.connect(self.c_change_select) # self.vfq_list = self.get_vfq_list() self.vfq_box = ExtendedComboBox() self.vfq_list = self.get_vfq_list() for index, value in enumerate(self.vfq_list): self.vfq_box.addItem("{}".format(self.vfq_list.get(value).upper()), value) self.vfq_box.setToolTip("vfq") formbox = QFormLayout() formbox.addRow(FLabel(DATE_DEMANTE), self.declaration_date_field) formbox.addRow(FLabel("1. " + DENOMINATION_S_SC), self.denomination_field) formbox.addRow(FLabel("2. " + NOM_COMMERCIAL), self.commercial_name_field) formbox.addRow(FLabel("3. " + DATE_CREATION_SC), self.created_date_field) formbox.addRow(FLabel("4. " + ACTIVITES_E), self.activites_box) formbox.addRow(FLabel("5. " + FILIERE), self.spinneret_box) formbox.addRow(FLabel("6. " + FORME_SC), self.formes_box) # Capital Social Initial capital_formbox = QFormLayout() capital_formbox.addRow(FLabel("7.1. " + MONTANT_PART_S), self.amount_part_social_field) capital_formbox.addRow(FLabel("7.2. " + MONTANT_APPORTS_NUM), self.apports_numeraire_field) capital_formbox.addRow(FLabel("7.3. " + MONTANT_APPORTS_NAT), self.apports_nature_field) capital_formbox.addRow(FLabel("7.4. " + MONTANT_APPORTS_INDU), self.apports_industrie_field) self.capitalSGroupBox = QGroupBox("7. " + MONTANT_CAPITAL_SI) self.capitalSGroupBox.setLayout(capital_formbox) self.capitalSGroupBox.setStyleSheet(CSS) # self.capitalSGroupBox.setMaximumWidth(1300) # Adresse du siège social self.vline = QFrame() self.vline.setFrameShape(QFrame.VLine) self.vline.setFrameShadow(QFrame.Sunken) self.addresGroupBox = QGroupBox("8. " + ADRESSE_SS) self.addresGroupBox.setStyleSheet(CSS) addres_gribox = QGridLayout() addres_gribox.addWidget(FRLabel(CERCLE), 0, 0) addres_gribox.addWidget(FLabel(self.office.cercle_name()), 0, 1) addres_gribox.addWidget(FRLabel(COMMUNE), 1, 0) addres_gribox.addWidget(self.commune_box, 1, 1) # addres_gribox.addWidget(self.vline, 0, 3, 2, 5) addres_gribox.addWidget(FRLabel(VFQ), 2, 0) addres_gribox.addWidget(self.vfq_box, 2, 1) addres_gribox.addWidget(FRLabel(RUE), 0, 2) addres_gribox.addWidget(self.rue_field, 0, 3) addres_gribox.addWidget(FRLabel(PORTE), 1, 2) addres_gribox.addWidget(self.porte_field, 1, 3) addres_gribox.addWidget(FRLabel(BP), 0, 4) addres_gribox.addWidget(self.bp_field, 0, 5) addres_gribox.addWidget(FRLabel(EMAIL), 1, 4) addres_gribox.addWidget(self.email_field, 1, 5) addres_gribox.addWidget(FRLabel(TEL), 2, 2) addres_gribox.addWidget(self.tel_field, 2, 3) addres_gribox.addWidget(FRLabel(TEL2), 2, 4) addres_gribox.addWidget(self.tel2_field, 2, 5) # addres_gribox.setColumnStretch(6, 5) self.addresGroupBox.setLayout(addres_gribox) # self.addresGroupBox.setMaximumWidth(1300) # Durée statutaire de la société coopérative duree_fbox = QFormLayout() duree_fbox.addRow(FLabel("9. " + DUREE_STATUTAIRE_SC), self.duree_statutaire_field) butt = Button_save(SAVE) butt.clicked.connect(self.save_and_goto_manager) butt_and_continous = Button_save(SAVE_AND_CONTINNUES) butt_and_continous.clicked.connect(self.save_and_goto_add_member) butt_and_continous.setMaximumWidth(300) duree_fbox.addRow(FLabel(""), FLabel("")) duree_fbox.addRow(butt, butt_and_continous) vbox = QVBoxLayout() vbox.addLayout(formbox) vbox.addWidget(self.capitalSGroupBox) vbox.addWidget(self.addresGroupBox) vbox.addLayout(duree_fbox) self.setLayout(vbox)
def save_edit(self): ''' add operation ''' if not self.is_valide(): return office = Office() office.slug = self.office_box.itemData(self.office_box.currentIndex()) office.slug_region = self.r_select office.slug_cercle = self.c_select office.phone = is_int(self.phone_field.text()) office.email_org = str(self.email_org.text()) office.bp = str(self.bp.text()) office.adress_org = str(self.adress_org.toPlainText()) office.save_() self.accept()
def test_office_add_error(self): with self.assertRaises(TypeError): Office.add_office(error_office)
sys.path.append(os.path.abspath('../')) from migrations import make_migrate from Common.ui.window import FWindow from Common.cmain import cmain from Common.ui.style_qss import theme app = QApplication(sys.argv) from ui.mainwindow import MainWindow def main(): window = MainWindow() window.setStyleSheet(theme) # setattr(FWindow, 'window', window) # window.show() window.showMaximized() sys.exit(app.exec_()) if __name__ == '__main__': if cmain(): make_migrate() from models import Office if Office().select().count() == 0: from PyQt4.QtGui import QDialog from ui.office_view import NewOrEditOfficeViewWidget if not NewOrEditOfficeViewWidget().exec_() == QDialog.Accepted: sys.exit(0) main()
def createBuilding(self, building): db.begin() try: Building(name=building.get("name")).save() if building.get("floors") is not None: for floor in building.get("floors"): Floor(level=floor.get("level"), buildingName=building.get("name")).save() if floor.get("waypoints") is not None: for waypoint in floor.get("waypoints"): if ("type" in waypoint): if (waypoint.get("type") == WAYPOINT_TYPES["ClassRoom"]): classRoom = ClassRoom( name=waypoint.get("name"), markerId=waypoint.get("markerId"), buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=waypoint.get("shapeType"), color=waypoint.get("color"), width=waypoint.get("width"), length=waypoint.get("length"), x=waypoint.get("x"), y=waypoint.get("y")).save() for schedule in waypoint["schedule"]: group = Group.nodes.get_or_none( name=schedule["group"], buildingName=building.get("name")) if group is None: group = Group( name=schedule["group"], buildingName=building.get( "name")).save() group.classes.connect( classRoom, { 'course': schedule["course"], 'dayOfWeek': schedule["dayOfWeek"], 'startTime': schedule["startTime"], 'finishTime': schedule["finishTime"] }) elif (waypoint.get("type") == WAYPOINT_TYPES["Office"]): office = Office( name=waypoint.get("name"), markerId=waypoint.get("markerId"), buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=waypoint.get("shapeType"), color=waypoint.get("color"), width=waypoint.get("width"), length=waypoint.get("length"), x=waypoint.get("x"), y=waypoint.get("y")).save() for prof in waypoint["professors"]: teacher = Teacher.nodes.get_or_none( name=prof, buildingName=building.get("name")) if teacher is None: teacher = Teacher( name=prof, buildingName=building.get( "name")).save() teacher.office.connect(office) elif (waypoint.get("type") == WAYPOINT_TYPES["Connector"]): Connector( name=waypoint.get("name"), markerId=waypoint.get("markerId"), buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=waypoint.get("shapeType"), color=waypoint.get("color"), width=waypoint.get("width"), length=waypoint.get("length"), x=waypoint.get("x"), y=waypoint.get("y")).save() else: Waypoint( name=waypoint.get("name"), markerId=waypoint.get("markerId"), buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=waypoint.get("shapeType"), color=waypoint.get("color"), width=waypoint.get("width"), length=waypoint.get("length"), x=waypoint.get("x"), y=waypoint.get("y")).save() else: Waypoint(name=waypoint.get("name"), markerId=waypoint.get("markerId"), buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=waypoint.get("shapeType"), color=waypoint.get("color"), width=waypoint.get("width"), length=waypoint.get("length"), x=waypoint.get("x"), y=waypoint.get("y")).save() if floor.get("hallways") is not None: for hallway in floor.get("hallways"): Hallway(name=hallway["name"], markerId=hallway["markerId"], buildingName=building.get("name"), floorLevel=floor.get("level"), shapeType=hallway["shapeType"], color=hallway["color"], width=hallway["width"], length=hallway["length"], x=hallway["x"], y=hallway["y"]).save() if building.get("floors") is not None: for floor in building.get("floors"): if floor.get("waypoints") is not None: for waypoint in floor.get("waypoints"): base = Waypoint.nodes.get( name=waypoint.get("name"), floorLevel=floor.get("level"), buildingName=building.get("name")) for neighbor in waypoint["neighbors"]: base.neighbors.connect( Waypoint.nodes.get( name=neighbor.get("name"), floorLevel=floor.get("level"), buildingName=building.get("name")), { 'direction': neighbor.get("direction") }) self.checkBuilding(building.get("name")) db.commit() return self.get(building.get("name")), 200 except Exception as e: db.rollback() return str(e), 500