Commit c31215a1 authored by Jérome Perrin's avatar Jérome Perrin Committed by Vincent Pelletier

Change http exchange API to pass HTTP Exchange to inquiry type based method

We pass the `HTTP Exchange` that `inquiry` type based methods can take into account the `HTTP Exchange` that triggered them.

This breaks API, but when discussing with @vpelletier we said that at this stage it's probably OK.

I updated `erp5_payline`, the only usage in this repository.

/cc @gabriel @kazuhiko @aurel @georgios.dagkakis 

/reviewed-on !245
parents 4bfcce31 f25348ea
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>http_exchange_value</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
assert context.getFollowUp() is None, context.getFollowUp() """Call HTTPExchange_getFollowUpFor* to find the document to use as follow up
of this HTTP Exchange and call inquiry type-based method on this document.
To use HTTP Exchange framework:
* you must have created categories in portal_categories/http_exchange_resource
* your "entry point" script must create an HTTP Exchange using an HTTP Exchange
Resource as resource category and confirm this HTTP Exchange.
In this entry point script, you should also set source and destination categories
if it helps traceability.
In this entry point script, you should set request and/or response properties.
* you must create HTTPExchange_getFollowUpFor${HTTP Exchange Resource Codification}
configuration script that will be called on the context of the HTTP Exchange and
will be responsible for returning the document on which inquiry will be done.
This script can create a new document and return it to use as follow up if applicable.
* you must create a `inquiry` type based method that will be called on this follow up
document, recieving the HTTP Exchange as argument.
"""
assert context.hasFollowUp(), context.getFollowUp()
http_exchange_resource = context.getPortalObject().portal_categories.http_exchange_resource http_exchange_resource = context.getPortalObject().portal_categories.http_exchange_resource
resource = context.getResourceValue() resource = context.getResourceValue()
...@@ -15,4 +33,4 @@ while True: ...@@ -15,4 +33,4 @@ while True:
follow_up = getattr(context, 'HTTPExchange_getFollowUpFor' + codification)() follow_up = getattr(context, 'HTTPExchange_getFollowUpFor' + codification)()
if follow_up is not None: if follow_up is not None:
context.setFollowUpValue(follow_up) context.setFollowUpValue(follow_up)
follow_up.getTypeBasedMethod('inquiry')() follow_up.getTypeBasedMethod('inquiry')(http_exchange_value=context)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment