コード例 #1
0
ファイル: logic.py プロジェクト: openbizgit/h
def create_annotation(fields):
    """Create and store an annotation."""
    annotation = Annotation(fields)
    search_lib.prepare(annotation)
    annotation.save()

    return annotation
コード例 #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
コード例 #3
0
ファイル: logic.py プロジェクト: bitsoffreedom/h
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
コード例 #4
0
ファイル: views.py プロジェクト: klrkdekira/h
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
コード例 #5
0
ファイル: views.py プロジェクト: robertknight/h
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
コード例 #6
0
ファイル: logic.py プロジェクト: apurvajalit/h
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