Example #1
0
def create_annotation(fields):
    """Create and store an annotation."""
    annotation = Annotation(fields)
    search_lib.prepare(annotation)
    annotation.save()

    return annotation
Example #2
0
def create_annotation(fields, userid):
    """Create and store an annotation."""
    # Create Annotation instance
    annotation = Annotation(fields)
    annotation['user'] = userid

    # Save it in the database
    search_lib.prepare(annotation)
    annotation.save()

    log.debug('Created annotation; user: %s', annotation['user'])

    return annotation
Example #3
0
def create_annotation(fields, userid):
    """Create and store an annotation."""
    # Some fields are not to be set by the user, ignore them
    for field in PROTECTED_FIELDS:
        fields.pop(field, None)

    # Create Annotation instance
    annotation = Annotation(fields)
    annotation['user'] = userid

    # Save it in the database
    search_lib.prepare(annotation)
    annotation.save()

    log.debug('Created annotation; user: %s', annotation['user'])

    return annotation
Example #4
0
def _create_annotation(fields, user):
    """Create and store an annotation."""

    # Some fields are not to be set by the user, ignore them
    for field in PROTECTED_FIELDS:
        fields.pop(field, None)

    # Create Annotation instance
    annotation = Annotation(fields)

    annotation['user'] = user.id
    annotation['consumer'] = user.consumer.key

    # Save it in the database
    annotation.save()

    log.debug('Created annotation; user: %s, consumer key: %s',
              annotation['user'], annotation['consumer'])

    return annotation
Example #5
0
def _create_annotation(fields, user):
    """Create and store an annotation."""

    # Some fields are not to be set by the user, ignore them
    for field in PROTECTED_FIELDS:
        fields.pop(field, None)

    # Create Annotation instance
    annotation = Annotation(fields)

    annotation['user'] = user.id
    annotation['consumer'] = user.consumer.key

    # Save it in the database
    annotation.save()

    log.debug('Created annotation; user: %s, consumer key: %s',
              annotation['user'], annotation['consumer'])

    return annotation
Example #6
0
def create_annotation(fields, user):
    """Create and store an annotation."""
    # Some fields are not to be set by the user, ignore them
    for field in PROTECTED_FIELDS:
        fields.pop(field, None)

    # Create Annotation instance
    annotation = Annotation(fields)

    annotation['user'] = user.id
    annotation['consumer'] = user.consumer.key

    if nipsa.has_nipsa(user.id):
        annotation["nipsa"] = True

    # Save it in the database
    search_lib.prepare(annotation)
    annotation.save()

    log.debug('Created annotation; user: %s, consumer key: %s',
              annotation['user'], annotation['consumer'])

    return annotation