예제 #1
0
    def importChannels(self):
        """ Import channels from the old project to the new project. """

        # make sure the ocp project exists
        pr = Project.objects.get(project_name=self.newproject_name)

        for channel in self.oldchannels.keys():
            ch = Channel()
            ch.project = pr
            ch.channel_name = channel
            ch.channel_description = 'Imported from oldchannel schema.'
            ch.channel_type = 'image'
            ch.resolution = 0
            ch.propagate = self.propagate
            ch.channel_datatype = self.datatype
            ch.readonly = self.readonly
            ch.exceptions = 0
            ch.startwindow = 0
            ch.endwindow = 0
            ch.default = False

            try:
                ch.save()
                pd = ocpcaproj.OCPCAProjectsDB()
                pd.newOCPCAChannel(pr.project_name, ch.channel_name)
                print "Created channel {}".format(channel)
            except Exception, e:
                print "[ERROR]: {}".format(e)
                exit()
예제 #2
0
  def importChannels(self):
    """ Import channels from the old project to the new project. """
      
    # make sure the ocp project exists 
    pr = Project.objects.get(project_name=self.newproject_name)

    for channel in self.oldchannels.keys():
      ch = Channel()
      ch.project = pr
      ch.channel_name = channel
      ch.channel_description = 'Imported from oldchannel schema.'
      ch.channel_type = 'image'
      ch.resolution = 0 
      ch.propagate = self.propagate
      ch.channel_datatype = self.datatype 
      ch.readonly = self.readonly
      ch.exceptions = 0
      ch.startwindow = 0
      ch.endwindow = 0
      ch.default = False

      try:
        ch.save()
        pd = ocpcaproj.OCPCAProjectsDB()
        pd.newOCPCAChannel( pr.project_name, ch.channel_name )
        print "Created channel {}".format(channel)
      except Exception, e:
        print "[ERROR]: {}".format(e)
        exit()