From 5094ca57209af7efd1fafb91dcee8bd702c77b35 Mon Sep 17 00:00:00 2001 From: Florent Pigout Date: Tue, 12 Aug 2014 17:14:33 +0200 Subject: [PATCH] Hacks the action splitter in case we want to use __ as separator before the action separator. --- elasticutils/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elasticutils/__init__.py b/elasticutils/__init__.py index f63474a..154f8d3 100644 --- a/elasticutils/__init__.py +++ b/elasticutils/__init__.py @@ -175,10 +175,13 @@ def split_field_action(s): 'foo', 'bar' >>> split_field_action('foo') 'foo', None + >>> split_field_action('creator__first_name__') + 'creator__first_name', None """ if '__' in s: - return s.rsplit('__', 1) + field, action = s.rsplit('__', 1) + return field, (action or None) return s, None