from pyramid.view import view_config

from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.view import BasicView

from novaideo.content.processes.proposal_management.behaviors import  CorrectProposal
from novaideo.content.proposal import Proposal
from novaideo import _


@view_config(
    name='correctproposal',
    context=Proposal,
    renderer='pontus:templates/view.pt',
    )
class CorrectProposalView(BasicView):
    title = _('Correct')
    name = 'correctproposal'
    behaviors = [CorrectProposal]
    viewid = 'correctproposal'


    def update(self):
        self.execute(None)        
        return self.behaviorinstances.values()[0].redirect(self.context, self.request)

DEFAULTMAPPING_ACTIONS_VIEWS.update({CorrectProposal:CorrectProposalView})

add correct proposal view