Пример #1
0
Файл: amqp.py Проект: brtsz/zato
def index(req):
    zato_clusters = req.odb.query(Cluster).order_by("name").all()
    choose_cluster_form = ChooseClusterForm(zato_clusters, req.GET)
    cluster_id = req.GET.get("cluster")
    items = []

    create_form = CreateForm()
    edit_form = EditForm(prefix="edit")

    if cluster_id and req.method == "GET":

        cluster = req.odb.query(Cluster).filter_by(id=cluster_id).first()

        def_ids = _get_def_ids(cluster)
        create_form.set_def_id(def_ids)
        edit_form.set_def_id(def_ids)

        zato_message = Element("{%s}zato_message" % zato_namespace)
        zato_message.data = Element("data")
        zato_message.data.cluster_id = cluster_id

        _, zato_message, soap_response = invoke_admin_service(cluster, "zato:channel.amqp.get-list", zato_message)

        if zato_path("data.item_list.item").get_from(zato_message) is not None:

            for msg_item in zato_message.data.item_list.item:

                id = msg_item.id.text
                name = msg_item.name.text
                is_active = is_boolean(msg_item.is_active.text)
                queue = msg_item.queue.text
                consumer_tag_prefix = msg_item.consumer_tag_prefix.text
                def_name = msg_item.def_name.text
                def_id = msg_item.def_id.text
                service_name = msg_item.service_name.text

                item = ChannelAMQP(id, name, is_active, queue, consumer_tag_prefix, def_id, def_name, service_name)
                items.append(item)

    return_data = {
        "zato_clusters": zato_clusters,
        "cluster_id": cluster_id,
        "choose_cluster_form": choose_cluster_form,
        "items": items,
        "create_form": create_form,
        "edit_form": edit_form,
    }

    # TODO: Should really be done by a decorator.
    if logger.isEnabledFor(TRACE1):
        logger.log(TRACE1, "Returning render_to_response [{0}]".format(return_data))

    return render_to_response("zato/channel/amqp.html", return_data, context_instance=RequestContext(req))
Пример #2
0
 def handle(self):
     create_form = CreateForm(req=self.req)
     edit_form = EditForm(prefix='edit', req=self.req)
     
     if self.req.zato.cluster_id:
         def_ids = get_definition_list(self.req.zato.client, self.req.zato.cluster, 'amqp')
         create_form.set_def_id(def_ids)
         edit_form.set_def_id(def_ids)
     
     return {
         'create_form': create_form,
         'edit_form': edit_form,
     }
Пример #3
0
    def handle(self):
        create_form = CreateForm(req=self.req)
        edit_form = EditForm(prefix='edit', req=self.req)

        if self.req.zato.cluster_id:
            def_ids = get_definition_list(self.req.zato.client, self.req.zato.cluster, 'amqp')
            create_form.set_def_id(def_ids)
            edit_form.set_def_id(def_ids)

        return {
            'create_form': create_form,
            'edit_form': edit_form,
        }
Пример #4
0
Файл: amqp.py Проект: dsuch/zato
 def handle(self):
     create_form = CreateForm()
     edit_form = EditForm(prefix='edit')
     
     if self.req.zato.cluster_id:
         def_ids = _get_def_ids(self.req.zato.cluster)
         create_form.set_def_id(def_ids)
         edit_form.set_def_id(def_ids)
     
     return {
         'create_form': create_form,
         'edit_form': edit_form,
     }