示例#1
0
def main(argv):
    category = -1
    meeting = -1
    show = 0

    try:
        opts, args = getopt.getopt(argv, "hm:c:s", ["help", "meeting=", "category=", "show"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            sys.exit()
        elif opt in ("-s", "--show"):
            show = 1
        elif opt in ("-m", "--meeting"):
            meeting = arg
        elif opt in ("-c", "--category"):
            category = arg

    # Create database instance and open trashcan manager object
    DBMgr.getInstance().startRequest()
    t = TrashCanManager()
    conf = None
    if show:
        for i in t.getList():
            if isinstance(i, Conference):
                if meeting != -1 and i.getId() == meeting:
                    print "[%s]%s" % (i.getId(), i.getTitle())
                elif meeting == -1:
                    print "[%s]%s" % (i.getId(), i.getTitle())
        sys.exit()
    if meeting != -1 and category != -1:
        print "Meeting:%s" % meeting
        print "Category:%s" % category
        for i in t.getList():
            if isinstance(i, Conference):
                if i.getId() == meeting:
                    conf = i
                    break

        if conf:
            # Remove the meeting from conference
            t.remove(conf)
            # Attach meeting to desired category
            cat = CategoryManager().getById(category)
            ConferenceHolder().add(conf)
            cat._addConference(conf)

            # Add Evaluation
            c = ConferenceHolder().getById(meeting)
            from MaKaC.evaluation import Evaluation

            c.setEvaluations([Evaluation(c)])

            DBMgr.getInstance().endRequest()
示例#2
0
 def delete(self):
     for obj in self.getObjList():
         self.removeObj(obj)
         # Id the delete method doesn't exist for obj it has to be
         # implemented.
         obj.delete()
     self.conf = None
     TrashCanManager().add(self)
示例#3
0
def main(argv):
    category = -1
    meeting = -1
    show = 0

    try:
        opts, args = getopt.getopt(argv, "hm:c:s",
                                   ["help", "meeting=", "category=", "show"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            sys.exit()
        elif opt in ("-s", "--show"):
            show = 1
        elif opt in ("-m", "--meeting"):
            meeting = arg
        elif opt in ("-c", "--category"):
            category = arg

    #Create database instance and open trashcan manager object
    DBMgr.getInstance().startRequest()
    t = TrashCanManager()
    conf = None
    if (show):
        for i in t.getList():
            if isinstance(i, Conference):
                if meeting != -1 and i.getId() == meeting:
                    print "[%s]%s" % (i.getId(), i.getTitle())
                elif meeting == -1:
                    print "[%s]%s" % (i.getId(), i.getTitle())
        sys.exit()
    if (meeting != -1 and category != -1):
        print "Meeting:%s" % meeting
        print "Category:%s" % category
        for i in t.getList():
            if isinstance(i, Conference):
                if i.getId() == meeting:
                    conf = i
                    break

        if conf:
            #Remove the meeting from conference
            t.remove(conf)
            #Attach meeting to desired category
            cat = CategoryManager().getById(category)
            ConferenceHolder().add(conf)
            cat._addConference(conf)

            #Add Evaluation
            c = ConferenceHolder().getById(meeting)
            from MaKaC.evaluation import Evaluation
            c.setEvaluations([Evaluation(c)])

            DBMgr.getInstance().endRequest()
示例#4
0
 def recover(self):
     TrashCanManager().remove(self)
示例#5
0
 def delete(self):
     TrashCanManager().add(self)
示例#6
0
 def recover(self):
     self.smtpServer = Config.getInstance().getSmtpServer()
     TrashCanManager().remove(self)
 def delete(self, user=None):
     signals.event.deleted.send(self, user=user)
     ConferenceHolder().remove(self)
     TrashCanManager().add(self)
     self._p_changed = True
示例#8
0
def main(argv):
    category = -1
    meeting = -1
    show = 0

    ContextManager.create()

    try:
        opts, args = getopt.getopt(argv, "hm:c:s", ["help","meeting=","category=", "show"])
    except getopt.GetoptError:
        usage()
        sys.exit(2)
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            usage()
            sys.exit()
        elif opt in ("-s","--show"):
            show = 1
        elif opt in ("-m","--meeting"):
            meeting = arg
        elif opt in ("-c","--category"):
            category = arg

    # Create database instance and open trashcan manager object
    DBMgr.getInstance().startRequest()
    t=TrashCanManager()
    conf = None
    if(show):
        for i in t.getList():
            if isinstance(i, Conference):
                if meeting != -1 and i.getId() == meeting:
                    print "[%s]%s"%(i.getId(),i.getTitle())
                elif meeting == -1:
                    print "[%s]%s"%(i.getId(),i.getTitle())
        sys.exit()

    if(meeting != -1 and category != -1):

        print "Meeting:%s"%meeting
        print "Category:%s" % category
        for i in t.getList():
            if isinstance(i,Conference):
                if i.getId() == meeting:
                    conf = i
                    break

        if conf:
            DBMgr.getInstance().sync()

            with RequestListenerContext():

                # Remove meeting from the TrashCanManager
                t.remove(conf)
                # Attach meeting to desired category
                cat = CategoryManager().getById(category)
                ConferenceHolder().add(conf)
                cat._addConference(conf)

                # Add Evaluation
                c = ConferenceHolder().getById(meeting)
                from MaKaC.evaluation import Evaluation
                c.setEvaluations([Evaluation(c)])

                # indexes
                c.indexConf()
                c._notify('created', cat)

                for contrib in c.getContributionList():
                    contrib._notify('created', c)
        else:
            print "not found!"

        DBMgr.getInstance().endRequest()

    ContextManager.destroy()