Beispiel #1
0
    def get(self, group_key):
        # confirm participant id in cookie
        c_group_key = ChatTrait.get_group_key(self)
        participant_key = ChatTrait.get_participant_key(self)

        # get group
        group = Group.get(group_key)

        # if participant is none or login to another group, create new participant in group
        if not participant_key:
            participant = Participant()
            participant.store(group.key)
            participant_key = participant.key
            ChatTrait.store_participant_key(self, participant_key)

        if c_group_key:
            if c_group_key != group_key:
                group.participant(Participant.get(participant_key))
                ChatTrait.store_group_key(self, group.key)
        else:
            ChatTrait.store_group_key(self, group.key)

        # return response
        self.render("chat.html", group_name=group.name)
Beispiel #2
0
    def get(self, group_key):
        # confirm participant id in cookie
        c_group_key = ChatTrait.get_group_key(self)
        participant_key = ChatTrait.get_participant_key(self)

        # get group
        group = Group.get(group_key)

        # if participant is none or login to another group, create new participant in group
        if not participant_key:
            participant = Participant()
            participant.store(group.key)
            participant_key = participant.key
            ChatTrait.store_participant_key(self, participant_key)

        if c_group_key:
            if c_group_key != group_key:
                group.participant(Participant.get(participant_key))
                ChatTrait.store_group_key(self, group.key)
        else:
            ChatTrait.store_group_key(self, group.key)

        # return response
        self.render("chat.html", group_name=group.name)