def sync_section(self, section_obj, exp_obj): try: section = GwoSection.objects.get( gwo_experiment=exp_obj, section_id=section_obj.section_id.text ) created = False except GwoSection.DoesNotExist: section = GwoSection( gwo_experiment=exp_obj, section_id=section_obj.section_id.text ) created = True if created: print " Building section %s" % section_obj.title.text else: print " Updating section %s" % section_obj.title.text section.title = section_obj.title.text section.begin_script = getattr(section_obj.section_begin_script, 'text', '') section.end_script = getattr(section_obj.section_end_script, 'text', '') section.save(local_only=True) print " Pulling Variations" try: var_feed = self.client.get_variations(client.VariationQuery(section_obj)) except Exception, e: print " Error pulling variations" return