Revision 69c822cc snf-astakos-app/astakos/im/functions.py

b/snf-astakos-app/astakos/im/functions.py
645 645
        trigger_sync()
646 646
    return membership
647 647

  
648
def submit_application(
649
        application, resource_policies, applicant, comments,
650
        precursor_application=None):
648
def submit_application(**kw):
649
    precursor_id = kw.pop('precursor_application', None)
650
    if precursor_id is not None:
651
        app = ProjectApplication.objects.get(id=precursor_id)
652
        app.id = None
653
        app.precursor_application_id = precursor_id
654
    else:
655
        app = ProjectApplication()
651 656

  
652
    application.submit(
653
        resource_policies, applicant, comments, precursor_application)
657
    app.state = app.PENDING
658
    app.issue_date = datetime.now()
659

  
660
    resource_policies = kw.pop('resource_policies', None)
661
    for k, v in kw.iteritems():
662
        setattr(app, k, v)
663
    app.save()
664
    app.resource_policies = resource_policies
654 665

  
655 666
    try:
656 667
        notification = build_notification(
......
662 673
        notification.send()
663 674
    except NotificationError, e:
664 675
        logger.error(e)
665
    return application
676
    return app.id
666 677

  
667 678
def update_application(app_id, **kw):
668 679
    app = ProjectApplication.objects.get(id=app_id)

Also available in: Unified diff