Commit 3d86332e authored by Clovis NZOUENDJOU's avatar Clovis NZOUENDJOU
Browse files

updating description in connection.py file

parent e6d80b197337
# -*- coding: utf-8 -*-
from osv import osv, fields
from openerp.osv import osv, fields
from kombu import Connection
import socket
from tools.translate import _
class anybusConnection(osv.Model):
""" Class used to establish the connection between your ERP and server RabbitMQ
.. Note::
The BrokerConnection class supports additional keyword arguments,
these are: hostname: Default host name if not provided in the URL.
userid: Default user name if not provided in the URL. password: Default password
if not provided in the URL. virtual_host: Default virtual host if not provided in the URL.
port: Default port if not provided in the URL. transport: Default transport if not provided in
the URL. Can be a string specifying the path to the class. (e.g. kombu.transport.pyamqplib.
Transport), or one of the aliases: amqplib, pika, redis, memory, and so on. ssl: Use SSL to
connect to the server. Default is False. Only supported by the amqp transport. insist:
Insist on connecting to a server. In a configuration with multiple load-sharing servers,
the insist option tells the server that the client is insisting on a connection to the
specified server. Default is False. Only supported by the amqp and pika transports, and not by
AMQP 0-9-1. connect_timeout: Timeout in seconds for connecting to the server. May not be
supported by the specified transport. transport_options: A dict of additional connection
arguments to pass to alternate kombu channel implementations. Consult the transport
documentation for available options.
"""
Class used to establish the connection between your ERP and server RabbitMQ
.. Note::
The BrokerConnection class supports additional keyword arguments,
these are: hostname: Default host name if not provided in the URL.
userid: Default user name if not provided in the URL. password: Default password
if not provided in the URL. virtual_host: Default virtual host if not provided in the
URL. port: Default port if not provided in the URL. transport: Default transport if
not provided in the URL. Can be a string specifying the path to the class.
(e.g. kombu.transport.pyamqplib. Transport), or one of the aliases: amqplib, pika,
redis, memory, and so on. ssl: Use SSL to connect to the server. Default is False.
Only supported by the amqp transport. insist: Insist on connecting to a server. In a
configuration with multiple load-sharing servers, the insist option tells the server
that the client is insisting on a connection to the specified server. Default is
False. Only supported by the amqp and pika transports, and not by AMQP 0-9-1.
connect_timeout: Timeout in seconds for connecting to the server. May not be
supported by the specified transport. transport_options: A dict of additional
connection arguments to pass to alternate kombu channel implementations. Consult the
transport
documentation for available options.
"""
_name = 'anybus.connection'
_description = 'anybus connection'
......@@ -49,13 +54,15 @@ class anybusConnection(osv.Model):
}
def _get_uri(self, cr, uid, connection, context=None):
""" return the uri of the connexion
"""
return the uri of the connexion
"""
return connection.uri % {'dbname': cr.dbname}
def action_declare(self, cr, uid, ids, context=None):
""" Function to declare a connection. When a connection is declared,
then you are connected to the RabbitMQ server.
"""
Function to declare a connection. When a connection is declared,
then you are connected to the RabbitMQ server.
"""
for connection in self.browse(cr, uid, ids, context=context):
try:
......@@ -75,8 +82,9 @@ class anybusConnection(osv.Model):
return {}
def action_redraft(self, cr, uid, ids, context=None):
""" This function searches all exchanges and queues that are reported
and changes their state in ``draft``
"""
This function searches all exchanges and queues that are reported
and changes their state in ``draft``
"""
exchange_obj = self.pool.get('anybus.entity.exchange')
exchange_ids = exchange_obj.search(
......@@ -90,8 +98,9 @@ class anybusConnection(osv.Model):
return {}
def action_declare_all(self, cr, uid, ids, context=None):
""" This function searches all exchanges and queues which are at the draft state
and ``declare`` it.
"""
This function searches all exchanges and queues which are at the draft state
and ``declare`` it.
"""
exchange_obj = self.pool.get('anybus.entity.exchange')
exchange_ids = exchange_obj.search(
......@@ -104,7 +113,8 @@ class anybusConnection(osv.Model):
return {}
def action_purge_all(self, cr, uid, ids, context=None):
""" Purge all queues which are at the draft state
"""
Purge all queues which are at the draft state
"""
queue_obj = self.pool.get('anybus.entity.queue')
queue_ids = queue_obj.search(
......@@ -114,6 +124,7 @@ class anybusConnection(osv.Model):
def get_actions(self, cr, uid, ids, model, context=None):
"""
"""
model_ids = self.pool.get(model).search(cr, uid, [], context=context)
res = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment