@require_objs_permissions_for_view(
    perm_names=["can_create_project"],
    permittee_func=get_user_from_req,
    target_func=get_queryset_from_class(Project),
)
def create(request):
    '''Create a new project'''
   
    def post_save(instance, created):
        # Create default roles in the project
	#Generate UUID: fixes caching problem on model default value
	instance.uuid = uuid.uuid4()
	create_project_roles(instance, request.user)
	instance.save()
	#if settings.LDAP_STORE_PROJECTS:
	#        instance.sync_netgroup_ldap()
        
    def redirect(instance):
        return reverse("project_detail", args=[instance.id])
    
    try:
        return generic_crud(
            request, None,
            model=Project,
            form_class=ProjectCreateForm,
            template=TEMPLATE_PATH+"/create_update.html",
            post_save=post_save,
            redirect=redirect,
            template_object_name="project",
            extra_context={
                "breadcrumbs": (
                    ("Home", reverse("home")),
                    ("Create Project", request.path),
                ),
            },
            success_msg = lambda instance: instance.name % "Successfully created project %s.",
        )
    except Exception as e:
        if isinstance(e,ldap.LDAPError):
            DatedMessage.objects.post_message_to_user(
                "Project has been created but only locally since LDAP is not reachable. You will not be able to add users to the project until connection is restored.",
                request.user, msg_type=DatedMessage.TYPE_ERROR)
        else:
            DatedMessage.objects.post_message_to_user(
                "Project may have been created, but some problem ocurred: %s" % str(e),
                request.user, msg_type=DatedMessage.TYPE_ERROR)
        return HttpResponseRedirect(reverse("home"))
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/project/views.py/create/swapped operands of `%`