def add_comment(self, body, allow_create=False, allow_hashes=True,
                    summary=None, hash_create=False):
        """Implement as required by CommentThread.add_comment.

        :arg body:    String/text of comment to add.

        :arg allow_create=False: Whether to automatically create a new thread
                                 if a thread does not exist (usually by calling
                                 self.create_thread).

        :arg allow_hashes=True:  Whether to support hashtag mentions of other
                                 topics and automatically insert comment in
                                 body into those topics as well.

                                 *IMPORTANT*: if you recursively call
                                 add_comment to insert the hashes, you should
                                 make sure to set this to False to prevent
                                 infinite hash processing loops.

        arg summary=None:        Optional summary. If not given, we will
                                 extract one from body automatically if
                                 necessary.

        :arg hash_create=False:  Whether to allow creating new threads via
                                 hash mentions.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        :returns:     Response object indicating whether added succesfully.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        PURPOSE:      This uses the GitHub API to try to add the given comment
                      to the desired thread.

        """
        if self.thread_id is None:
            self.thread_id = self.lookup_thread_id()
        data = json.dumps({'body': body})
        if self.thread_id is None:
            if allow_create:
                return self.create_thread(body)
            else:
                raise ValueError(
                    'Cannot find comment existing comment for %s' % self.topic)

        result = requests.post('%s/issues/%s/comments' % (
            self.base_url, self.thread_id), data, auth=(self.user, self.token))
        if result.status_code != 201:
            if result.reason == 'Not Found' and allow_create:
                return self.create_thread(body)
            else:
                raise GitHubAngry(
                    'Bad status %s add_comment on %s because %s' % (
                        result.status_code, self.topic, result.reason))

        if allow_hashes:
            self.process_hashes(body, allow_create=hash_create)

        return result
def add_comment ( self , body , allow_create = False , allow_hashes = True , summary = None , hash_create = False ) : if self . thread_id is None : self . thread_id = self . lookup_thread_id ( ) data = json . dumps ( { 'body' : body } ) if self . thread_id is None : if allow_create : return self . create_thread ( body ) else : raise ValueError ( 'Cannot find comment existing comment for %s' % self . topic ) result = requests . post ( '%s/issues/%s/comments' % ( self . base_url , self . thread_id ) , data , auth = ( self . user , self . token ) ) if result . status_code != 201 : if result . reason == 'Not Found' and allow_create : return self . create_thread ( body ) else : raise GitHubAngry ( 'Bad status %s add_comment on %s because %s' % ( result . status_code , self . topic , result . reason ) ) if allow_hashes : self . process_hashes ( body , allow_create = hash_create ) return result
Implement as required by CommentThread.add_comment.

        :arg body:    String/text of comment to add.

        :arg allow_create=False: Whether to automatically create a new thread
                                 if a thread does not exist (usually by calling
                                 self.create_thread).

        :arg allow_hashes=True:  Whether to support hashtag mentions of other
                                 topics and automatically insert comment in
                                 body into those topics as well.

                                 *IMPORTANT*: if you recursively call
                                 add_comment to insert the hashes, you should
                                 make sure to set this to False to prevent
                                 infinite hash processing loops.

        arg summary=None:        Optional summary. If not given, we will
                                 extract one from body automatically if
                                 necessary.

        :arg hash_create=False:  Whether to allow creating new threads via
                                 hash mentions.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        :returns:     Response object indicating whether added succesfully.

        ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

        PURPOSE:      This uses the GitHub API to try to add the given comment
                      to the desired thread.