def create_experiment(self, exp_obj):
     print "  Building experiment %s" % exp_obj.title.text
     expr = dict(
         title=exp_obj.title.text,
         experiment_id=getattr(exp_obj.experiment_id, 'text', ''),
         experiment_type=exp_obj.experiment_type.text,
         control_script=getattr(exp_obj.control_script, 'text', ''),
         tracking_script=getattr(exp_obj.tracking_script, 'text', ''),
         conversion_script=getattr(exp_obj.conversion_script, 'text', ''),
         status=getattr(exp_obj.status, 'text', 'New'),
         auto_prune_mode=getattr(exp_obj.auto_prune_mode, 'text', 'None'),
         test_url=exp_obj.get_test_link() or '',
         goal_url=exp_obj.get_goal_link() or ''
     )
     
     exp = GwoExperiment(**expr)
     exp.save(local_only=True)
     print "  Pulling sections"
     section_feed = self.client.get_sections(client.SectionQuery(exp_obj.experiment_id.text))
     for sum_section_obj in section_feed.entry:
         section_obj = self.client.get_section(sum_section_obj.get_self_link().href)
         self.create_section(section_obj, exp)
 def sync_experiment(self, exp_obj):
     try:
         experiment = GwoExperiment.objects.get(
             experiment_id=exp_obj.experiment_id.text
         )
         created = False
     except GwoExperiment.DoesNotExist:
         experiment = GwoExperiment(experiment_id=exp_obj.experiment_id.text)
         created = False
     if created:
         print "  Building experiment %s" % exp_obj.title.text
     else:
         print "  Updating experiment %s" % exp_obj.title.text
     expr = dict(
         title=exp_obj.title.text,
         experiment_id=getattr(exp_obj.experiment_id, 'text', ''),
         experiment_type=exp_obj.experiment_type.text,
         control_script=getattr(exp_obj.control_script, 'text', ''),
         tracking_script=getattr(exp_obj.tracking_script, 'text', ''),
         conversion_script=getattr(exp_obj.conversion_script, 'text', ''),
         status=getattr(exp_obj.status, 'text', 'New'),
         auto_prune_mode=getattr(exp_obj.auto_prune_mode, 'text', 'None'),
         test_url=exp_obj.get_test_link() or '',
         goal_url=exp_obj.get_goal_link() or ''
     )
     
     for key, val in expr.items():
         setattr(experiment, key, val)
     
     experiment.save(local_only=True)
     print "  Pulling sections"
     try:
         section_feed = self.client.get_sections(client.SectionQuery(exp_obj.experiment_id.text))
     except Exception, e:
         print "  Error getting sections"
         return