@@ -0,0 +1,1634 @@
+# configure django to use default settings%0A# note that this can also be done using an environment variable%0Afrom django.conf import settings%0Afrom django.core.exceptions import ImproperlyConfigured%0A%0Aif hasattr(settings, 'DEBUG'):%0A    # settings are configured already%0A    pass%0Aelse:%0A    # load default settings if they're not set%0A    from web_app import settings as defaults%0A    settings.configure(default_settings=defaults, DEBUG=True)%0A%0Aimport ion_channel.models as C%0Aimport PyOpenWorm as P%0Afrom django.forms.models import model_to_dict%0A%0A%0Aclass PatchClampAdapter(object):%0A    %22%22%22Map a channelworm model to a pyopenworm model%22%22%22%0A%0A    def __init__(self, cw_obj):%0A        # initialize PyOpenWorm connection so we can access its API%0A        P.connect()%0A%0A        self.channelworm_object = cw_obj%0A        cw_dict = model_to_dict(self.channelworm_object)%0A%0A        experiment_id = cw_dict.pop('experiment')%0A        patch_clamp_id = cw_dict.pop('id')%0A%0A        self.pyopenworm_object = P.Experiment()%0A        %0A        # get the CW model's experiment%0A        cw_evidence = C.Experiment.objects.get(id=experiment_id)%0A%0A        # make a PyOW evidence object with it%0A        pow_evidence = P.Evidence(doi=cw_evidence.doi)%0A%0A        # add it to the PyOW experiment model%0A        self.pyopenworm_object.reference(pow_evidence)%0A%0A        for key, value in cw_dict.iteritems():%0A            self.pyopenworm_object.conditions.set(key, value)%0A%0A        # we not longer need PyOW API so we can kill the connection%0A        P.disconnect()%0A%0A    def get_pow(self):%0A        return self.pyopenworm_object%0A%0A    def get_cw(self):%0A        return self.channelworm_object%0A

Fix configuration imports. Adapter now works.