Beispiel #1
0
def _registered_edition_alice():
    from acl.models import ActionControl
    from ownership.models import OwnershipEditions
    from piece.models import Edition
    piece = _registered_piece_alice()
    alice_bitcoin_wallet = _alice_bitcoin_wallet()
    alice = piece.user_registered
    if piece.num_editions != -1:
        raise DynamicFixtureError(
            'Expecting piece.num_editions to be "-1", not "{}"'.format(
                piece.num_editions)
        )

    # piece.num_editions = 0
    bitcoin_path = alice_bitcoin_wallet.create_new_address()
    edition = Edition.objects.create(
        parent=piece,
        bitcoin_path=bitcoin_path,
        edition_number=1,
        owner=alice,
    )
    piece.num_editions = 1
    piece.save()
    ownership_editions = OwnershipEditions.create(
        edition=piece,
        new_owner=alice,
    )
    ownership_editions.save()
    ActionControl.set_acl_registree_edition(user=alice, edition=edition)
    return edition
Beispiel #2
0
def registered_edition_alice(djroot_bitcoin_wallet, registered_piece_alice,
                             alice_bitcoin_wallet):
    from acl.models import ActionControl
    from ownership.models import OwnershipEditions
    from piece.models import Edition
    alice = alice_bitcoin_wallet.user
    bitcoin_path = alice_bitcoin_wallet.create_new_address()
    edition = Edition.objects.create(
        parent=registered_piece_alice,
        bitcoin_path=bitcoin_path,
        edition_number=1,
        owner=alice,
    )
    registered_piece_alice.num_editions = 1
    registered_piece_alice.save()
    ownership_editions = OwnershipEditions.create(
        edition=registered_piece_alice,
        new_owner=alice,
    )
    ownership_editions.save()
    ActionControl.set_acl_registree_edition(user=alice, edition=edition)
    return edition
Beispiel #3
0
def on_editions_create(sender, user_registered, editions, *args, **kwargs):
    logger.info('SIGNAL on_editions_create')
    for edition in editions:
        db_edition = Edition.objects.get(bitcoin_path=edition.bitcoin_path)
        ActionControl.set_acl_registree_edition(user=user_registered,
                                                edition=db_edition)