ed49ea2188b8e8972a1a4a723635c57b48b5dc09,dino/db/rdbms/handler.py,DatabaseRdbms,is_banned_from_room,#DatabaseRdbms#Any#Any#,1341

Before Change


    def is_banned_from_room(self, room_id: str, user_id: str) -> (bool, Union[str, None]):
        now = datetime.utcnow()
        duration, time, username = self.env.cache.get_room_ban_timestamp(room_id, user_id)
        if time is not None:
            if time == "":
                return False, None

            time = datetime.fromtimestamp(float(time))
            if now > time:
                self.remove_room_ban(room_id, user_id)
                return False, None
            return True, str((time-now).seconds)

        duration, time, username = self.get_room_ban_timestamp(room_id, user_id)
        if time is None:
            self.env.cache.set_room_ban_timestamp(room_id, user_id, "", "", "")
            return False, None
        if now > time:
            self.remove_room_ban(room_id, user_id)
            return False, None

        self.env.cache.set_room_ban_timestamp(room_id, user_id, time.strftime(ConfigKeys.DEFAULT_DATE_FORMAT))
        return True, str((time-now).seconds)

    @with_session

After Change


    def is_banned_from_room(self, room_id: str, user_id: str) -> (bool, Union[str, None]):
        now = datetime.utcnow()
        duration, time, username = self.env.cache.get_room_ban_timestamp(room_id, user_id)
        if time is not None and len(time.strip()) != 0:
            if time == "":
                return False, None

            time = datetime.fromtimestamp(float(time))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: thenetcircle/dino
Commit Name: ed49ea2188b8e8972a1a4a723635c57b48b5dc09
Time: 2016-11-25
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: is_banned_from_room


Project Name: thenetcircle/dino
Commit Name: ed49ea2188b8e8972a1a4a723635c57b48b5dc09
Time: 2016-11-25
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: is_banned_globally


Project Name: thenetcircle/dino
Commit Name: ed49ea2188b8e8972a1a4a723635c57b48b5dc09
Time: 2016-11-25
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: is_banned_from_channel