Rfaulk has submitted this change and it was merged.

Change subject: add. methods to handle encoding response for broker.
......................................................................


add. methods to handle encoding response for broker.

Change-Id: Ie55ba55070dd870ed7391fa730afae0c28c1028f
---
M user_metrics/api/engine/__init__.py
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/user_metrics/api/engine/__init__.py 
b/user_metrics/api/engine/__init__.py
index 0fc7e57..2f38edd 100644
--- a/user_metrics/api/engine/__init__.py
+++ b/user_metrics/api/engine/__init__.py
@@ -56,6 +56,8 @@
 # The default value for non-assigned and valid values in the query string
 DEFAULT_QUERY_VAL = 'present'
 
+# DELIMETER FOR RESPONSE IN BROKER
+RESPONSE_DELIMETER = '<&>'
 
 #
 # Cohort parsing methods
@@ -150,3 +152,17 @@
 
     del conn
     return utm_touched.strftime(DATETIME_STR_FORMAT)
+
+
+def pack_response_for_broker(request, data):
+    """
+    Packs up response data for broker
+    """
+    return str(''.join([request, RESPONSE_DELIMETER, data]))
+
+
+def unpack_response_for_broker(value):
+    """
+    unpacks up response data from broker
+    """
+    return value.split(RESPONSE_DELIMETER)

-- 
To view, visit https://gerrit.wikimedia.org/r/77684
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie55ba55070dd870ed7391fa730afae0c28c1028f
Gerrit-PatchSet: 1
Gerrit-Project: analytics/user-metrics
Gerrit-Branch: master
Gerrit-Owner: Rfaulk <[email protected]>
Gerrit-Reviewer: Rfaulk <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to