scout/adapter/mongo/event.py
def comment(self, institute, case, user, link, variant=None,
                content="", comment_level="specific"):
        """Add a comment to a variant or a case.

        This function will create an Event to log that a user have commented on
        a variant. If a variant id is given it will be a variant comment.
        A variant comment can be 'global' or specific. The global comments will
        be shown for this variation in all cases while the specific comments
        will only be shown for a specific case.

        Arguments:
            institute (dict): A Institute object
            case (dict): A Case object
            user (dict): A User object
            link (str): The url to be used in the event
            variant (dict): A variant object
            content (str): The content of the comment
            comment_level (str): Any one of 'specific' or 'global'.
                                 Default is 'specific'

        Return:
            comment(dict): The comment event that was inserted
        """
        if not comment_level in COMMENT_LEVELS:
            raise SyntaxError("Comment levels can only be in {}".format(','.join(COMMENT_LEVELS)))

        if variant:
            LOG.info("Creating event for a {0} comment on variant {1}".format(
                comment_level, variant['display_name']))

            comment = self.create_event(
                institute=institute,
                case=case,
                user=user,
                link=link,
                category='variant',
                verb='comment',
                level=comment_level,
                variant=variant,
                subject=variant['display_name'],
                content=content
            )

        else:
            LOG.info("Creating event for a comment on case {0}".format(
                case['display_name']))

            comment = self.create_event(
                institute=institute,
                case=case,
                user=user,
                link=link,
                category='case',
                verb='comment',
                subject=case['display_name'],
                content=content
            )
        return comment
def comment(self, institute, case, user, link, variant=None,
                content="", comment_level="specific"):
        if not comment_level in COMMENT_LEVELS:
            raise SyntaxError("Comment levels can only be in {}".format(','.join(COMMENT_LEVELS)))

        if variant:
            LOG.info("Creating event for a {0} comment on variant {1}".format(
                comment_level, variant['display_name']))

            comment = self.create_event(
                institute=institute,
                case=case,
                user=user,
                link=link,
                category='variant',
                verb='comment',
                level=comment_level,
                variant=variant,
                subject=variant['display_name'],
                content=content
            )

        else:
            LOG.info("Creating event for a comment on case {0}".format(
                case['display_name']))

            comment = self.create_event(
                institute=institute,
                case=case,
                user=user,
                link=link,
                category='case',
                verb='comment',
                subject=case['display_name'],
                content=content
            )
        return comment
def comment ( self , institute , case , user , link , variant = None , content = "" , comment_level = "specific" ) : if not comment_level in COMMENT_LEVELS : raise SyntaxError ( "Comment levels can only be in {}" . format ( ',' . join ( COMMENT_LEVELS ) ) ) if variant : LOG . info ( "Creating event for a {0} comment on variant {1}" . format ( comment_level , variant [ 'display_name' ] ) ) comment = self . create_event ( institute = institute , case = case , user = user , link = link , category = 'variant' , verb = 'comment' , level = comment_level , variant = variant , subject = variant [ 'display_name' ] , content = content ) else : LOG . info ( "Creating event for a comment on case {0}" . format ( case [ 'display_name' ] ) ) comment = self . create_event ( institute = institute , case = case , user = user , link = link , category = 'case' , verb = 'comment' , subject = case [ 'display_name' ] , content = content ) return comment
Add a comment to a variant or a case.

        This function will create an Event to log that a user have commented on
        a variant. If a variant id is given it will be a variant comment.
        A variant comment can be 'global' or specific. The global comments will
        be shown for this variation in all cases while the specific comments
        will only be shown for a specific case.

        Arguments:
            institute (dict): A Institute object
            case (dict): A Case object
            user (dict): A User object
            link (str): The url to be used in the event
            variant (dict): A variant object
            content (str): The content of the comment
            comment_level (str): Any one of 'specific' or 'global'.
                                 Default is 'specific'

        Return:
            comment(dict): The comment event that was inserted
Add a comment to a variant or a case .