def create_or_update_business(self, alias_name, import_data): business = self.businessDao.query_by_alias(alias_name) if business is not None: business_key = business.key import_data.business_id = business_key logger.info('Business Already Exist with Key %s' % str(business_key)) else: try: business = Business() business.name = import_data.name business.description = import_data.description business.alias = import_data.alias business.contact_info = import_data.contact_info business_key = self.businessDao.persist( business, self.user_info) import_data.business_id = business_key logger.info('New Business Created for %s with key %s' % (alias_name, str(business_key))) except StandardError as e: #Skip the error and continue logger.error('Error occured, %s, for %s' % (str(e), alias_name)) raise return business_key
def create_or_update_business(self, playground): if playground.business_id is not None: business = self.businessDao.get_record(long(playground.business_id.id())) else: business = Business() business.name = playground.name business.description = playground.description business.alias = playground.alias business.contact_info = playground.contact_info return business
def create_or_update_business(self, event): if event.business_id is not None: business = self.businessDao.get_record(long(event.business_id.id())) else: business = Business() business.name = event.name business.description = event.description business.alias = event.alias business.contact_info = event.contact_info return business
def create_or_update_business(self, trainingcentre): if trainingcentre.business_id is not None: business = self.businessDao.get_record(long(trainingcentre.business_id.id())) else: business = Business() business.name = trainingcentre.name business.description = trainingcentre.description business.alias = trainingcentre.alias business.contact_info = trainingcentre.contact_info return business