Skip to content

Commit

Permalink
Merge pull request #28 from annawzz/a303035495659236_error_handler_event
Browse files Browse the repository at this point in the history
a303035495659236 Add error handler event subscriber
  • Loading branch information
vmaksymiv committed Apr 8, 2017
2 parents a0a9391 + dbc3748 commit 4ffe223
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions openprocurement/planning/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ def includeme(config):
config.add_request_method(extract_plan, 'plan', reify=True)
config.add_request_method(plan_from_data)
config.scan("openprocurement.planning.api.views")
config.scan("openprocurement.planning.api.subscribers")
10 changes: 10 additions & 0 deletions openprocurement/planning/api/subscribers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from pyramid.events import subscriber
from openprocurement.api.events import ErrorDesctiptorEvent


@subscriber(ErrorDesctiptorEvent)
def plan_error_handler(event):
if 'plan' in event.request.validated:
event.params['PLAN_REV'] = event.request.validated['plan'].rev
event.params['PLANID'] = event.request.validated['plan'].planID

0 comments on commit 4ffe223

Please sign in to comment.