Exemplo n.º 1
0
 def encode(self):
     self.name = utils.encode_null(self.name)
     self.place = utils.encode_null(self.place)
     self.url = utils.encode_null(self.url)
     self.source = utils.encode_null(self.source)
     self.info= utils.encode_null(self.info)
     self.style= utils.encode_null(self.style)
Exemplo n.º 2
0
            print "  - %s" % str(par)
            print ("update events set finished = true where id = %s" % (par[0]))
            cursor.execute("update events set finished = true where id = %s", (par[0]))
        really_new_events = []

        print "\n- updated parties: "
        for p in new_events:
            # we check for renaming, redating and replacing, if more than one changed then the party will be cancelled and recreated instead of just updated
            (possible_match, possible_dead_db_events) = check_renaming(p, possible_dead_db_events)
            if not possible_match:
                (possible_match, possible_dead_db_events) = check_redating(p, possible_dead_db_events)
                if not possible_match:
                    (possible_match, possible_dead_db_events) = check_replacing(p, possible_dead_db_events)
            if possible_match:
                print p.name.__repr__()
                print "  - %s %s possibly match with party %s" % (p.time, utils.encode_null(p.name), possible_match)
                print (
                    "update events set name =%s, place= %s, time_start = %s, updated = %s where id = %s"
                    % (utils.capitalize_words(p.name), p.place, p.time, datetime.now(), possible_match)
                )
                cursor.execute(
                    "update events set name =%s, place= %s, time_start = %s, updated = %s where id = %s",
                    (utils.capitalize_words(p.name), p.place, p.time, datetime.now(), possible_match),
                )
                set_location(cursor, possible_match, p.place)
            else:
                really_new_events.append(p)

        print "\n- cancelled parties:"
        for par in [p for p in possible_dead_db_events if p[3] >= datetime.now()]:
            print "  - %s" % str(par)