Add getting contact by field #29
Add getting contact by field #29
Conversation
@rudigiesler Do we match for a missing / present |
@SteveBarnett Not at the moment. It's an exact match for now. We could do that, but it would make things a little more complicated (we would have to have different things for different field types, eg. msisdn we would have to look for |
I think the tests are failing due to the riak version, checking up on this. |
@rudigiesler How about a shorter / simpler version: strip leading |
@SteveBarnett This does a Riak index query under the hood, so we can only look up exact values. We could manipulate the query string before we search, but we don't necessarily have |
raise CollectionUsageError( | ||
"Query must be of the form 'field=value'") | ||
valid_keys = self.delivery_classes.keys() | ||
if field not in valid_keys: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could combine these two lines into if field not in self.delivery_classes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And just use self.delivery_classes.keys()
in the error message (perhaps sorted?).
@SteveBarnett @jerith @rudigiesler |
Slightly radical suggestion -- long term we're trying to get rid of @rudi Thoughts? |
@hodgestar: It is something we can do, but it will add a bunch of time to this already unplanned task. I'll leave the decision up to you as whether it is worth the extra time or not. |
@rudi I think let's do this -- it's a little extra work, but it helps kill delivery classes, which is a worthy goal. (copied from Slack for the record). |
@hodgestar This is now using the new vumi-go things. Ready for review. |
sorted(Contact.ADDRESS_FIELDS)) | ||
|
||
try: | ||
value = normalize_addr(field, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the call to normalize_addr
be moved outside the try:
block?
👍 as soon as Travis is happy. |
…tact-by-field Add getting contact by field
We want to be able to get a contact by specifying a specific field, for example
msisdn
. The queries should have the form?q='msisdn=+1234'