Esempio n. 1
0
def agreement_factory(**kwargs):
    """
    Create an agreement with some defaults.
    """
    if 'issuer' not in kwargs:
        kwargs['issuer'] = models.Issuer(name='')
        kwargs['issuer'].save()

    args = {
        'file_name': '',
        'size': 0,
        'uri': 'https://example.com',
        'description': '',
    }

    for key in kwargs:
        args[key] = kwargs[key]
    agreement = models.Agreement(**args)

    agreement.save()

    return agreement
Esempio n. 2
0
def agreement_factory(**kwargs):
    """
    Create an agreement with some defaults.
    """
    if "issuer" not in kwargs:
        kwargs["issuer"] = models.Issuer(name="")
        kwargs["issuer"].save()

    args = {
        "file_name": "",
        "size": 0,
        "uri": "https://example.com",
        "description": "",
    }

    for key in kwargs:
        args[key] = kwargs[key]
    agreement = models.Agreement(**args)

    agreement.save()

    return agreement