예제 #1
0
 def add_office(self, entity, office):
     """ adds office and links it to entity """
     o = Office()
     o.entity = entity
     o.description = office["description"]
     o.addr_1 = office["address1"]
     o.addr_2 = office["address2"]
     o.zip_code = office["zip_code"]
     o.city = office["city"]
     o.state_code = office["state_code"]
     o.country_code = office["country_code"]
     if o.latitude:
         o.latitude = str(office["latitude"])
     if o.longitude:
         o.longitude = str(office["longitude"])
     o.save()
     sys.stdout.write(o.name().encode("utf8", "ignore") + " added\n")
예제 #2
0
	def addOffice(self,entity,office):
		""" adds office and links it to entity """
		o = Office()
		o.entity = entity
		o.description = office['description']
		o.addr_1 = office['address1']
		o.addr_2 = office['address2']
		o.zip_code = office['zip_code']
		o.city = office['city']
		o.state_code = office['state_code']
		o.country_code = office['country_code']
		if o.latitude:
			o.latitude = str(office['latitude'])
		if o.longitude:
			o.longitude = str(office['longitude'])
		o.save()
		self.stdout.write(o.name().encode('utf8','ignore') + " added\n")