From 4ee6f2bdb38e71ce7e9d57c1361b3b2c9a43b95e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sun, 3 Nov 2013 12:30:22 -0500 Subject: [PATCH] Have rest explorer provide for the ability of enumerated values be a dropdown selection --- confluent/messages.py | 46 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/confluent/messages.py b/confluent/messages.py index 48b96a8a..608451a8 100644 --- a/confluent/messages.py +++ b/confluent/messages.py @@ -7,6 +7,8 @@ import confluent.exceptions as exc import json class ConfluentMessage(object): + defaultvalue = '' + defaulttype = 'text' def __init__(self): raise NotImplementedError("Must be subclassed!") @@ -24,16 +26,13 @@ class ConfluentMessage(object): for key in self.kvpairs.iterkeys(): val = self.kvpairs[key] label = key - value = '' + value = self.defaultvalue note = '' - type = 'text' + type = self.defaulttype if 'value' in val: value = val['value'] if 'note' in val: note = '(' + val['note'] + ')' - if val['note'] == 'Encrypted': - type = 'password' - value = 'dummyvalue' snippet += label + ":" + \ '%s' % ( type, key, value, note) @@ -42,6 +41,26 @@ class ConfluentMessage(object): return snippet +class ConfluentChoiceMessage(ConfluentMessage): + + def html(self): + snippet = "" + for key in self.kvpairs.iterkeys(): + val = self.kvpairs[key] + snippet += key + ':' + snippet += '