Beispiel #1
0
    def query_with_schema(self):
        ret = self.query()
        container = self.open_container(self.form['container'].value)
        schema = tioclient.decode(container.get_property('schema'))

        result_set = ret['result_set']

        for x in xrange(len(result_set)):
            item_dict = result_set[x]
            raw_value = item_dict['value']
            values = tioclient.decode(raw_value)
            item_dict.update(dict(zip(schema, values)))

        return ret
Beispiel #2
0
    def query_with_schema(self):
        ret = self.query()
        container = self.open_container(self.form['container'].value)
        schema = tioclient.decode(container.get_property('schema'))

        result_set = ret['result_set']

        for x in xrange(len(result_set)):
            item_dict = result_set[x]
            raw_value = item_dict['value']
            values = tioclient.decode(raw_value)
            item_dict.update(dict(zip(schema, values)))

        return ret        
Beispiel #3
0
    def publications(self):
        ret = {'result': 'ok'}
        pubs = []

        count = len(self.publications_container)

        if self.form.has_key('limit'):
            limit = int(self.form['limit'].value)
            if limit < count:
                count = limit

        for index in range(count):
            key, value, metadata = self.publications_container.get(
                index, withKeyAndMetadata=True)
            pub_values = {'container': metadata}

            # the event info in codified in the "value" field
            event, key, value, metadata = tioclient.decode(value)
            pub_values['event'] = event
            if not key is None: pub_values['key'] = key
            if not value is None: pub_values['value'] = value
            if not metadata is None: pub_values['metadata'] = metadata

            pubs.append(pub_values)

        # this way we'll remove items from the list only if everything is ok
        for index in range(count):
            self.publications_container.pop_front()

        ret['publications'] = pubs

        return ret
Beispiel #4
0
    def publications(self):
        ret = {'result': 'ok'}
        pubs = []

        count = len(self.publications_container)

        if self.form.has_key('limit'):
            limit = int(self.form['limit'].value)
            if limit < count:
                count = limit

        for index in range(count):
            key, value, metadata = self.publications_container.get(index, withKeyAndMetadata=True)
            pub_values = {'container' : metadata}

            # the event info in codified in the "value" field
            event, key, value, metadata = tioclient.decode(value)
            pub_values['event'] = event
            if not key is None: pub_values['key'] = key
            if not value is None: pub_values['value'] = value
            if not metadata is None: pub_values['metadata'] = metadata

            pubs.append(pub_values)

        # this way we'll remove items from the list only if everything is ok
        for index in range(count):
            self.publications_container.pop_front()

        ret['publications'] = pubs

        return ret