def delete_follower(self, guid):
     cursor = self.db.cursor()
     f = Followers()
     ser = self.get_followers()
     if ser is not None:
         f.ParseFromString(ser)
         for follower in f.followers:
             if follower.guid == guid:
                 f.followers.remove(follower)
     cursor.execute('''INSERT OR REPLACE INTO followers(id, serializedFollowers) VALUES (?,?)''',
                    (1, f.SerializeToString()))
     self.db.commit()
Beispiel #2
0
 def set_follower(self, proto):
     conn = Database.connect_database(self.PATH)
     with conn:
         cursor = conn.cursor()
         f = Followers()
         ser = self.get_followers()
         if ser is not None:
             f.ParseFromString(ser)
             for follower in f.followers:
                 if follower.guid == proto.guid:
                     f.followers.remove(follower)
         f.followers.extend([proto])
         cursor.execute('''INSERT OR REPLACE INTO followers(id, serializedFollowers) VALUES (?,?)''',
                        (1, f.SerializeToString()))
         conn.commit()
     conn.close()