ConnectionData

A custom datatype, capable of parsing conf files in the following format:

[CONNECTION]
# the name you use to identify this connection. must be unique.
name = demo

# information use to specify the connection type.
type = TCP/IP
auth = password

# the following fields are required for connection to a postgres database

host = localhost
port = 5432
db_name = openmolar_demo
user = om_demo
password = password

methods and attributes

class lib_openmolar.common.datatypes.connection_data.ConnectionData(connection_name='', user='', password='', host='', port=5432, db_name='')[source]

Bases: object

A custom data type to store information on how the application can connect to a postgres database.

__init__(connection_name='', user='', password='', host='', port=5432, db_name='')[source]
CONNECTION_TYPE = 0

the default connection is TCP/IP (ie. username and password connection to a specific database name on a known host and port)

SOCKET = 1
TCP_IP = 0
brief_name[source]

a short, readable name for this connection.

conf_file = None

an attribute to store the location of the conf file for this connection

connection_name[source]

a detailed, readable name for this connection.

db_name = None
demo_connection()[source]

returns params for a TCP_IP connection on localhost:5432 to openmolar_demo with the default user and password.

from_conf_file(conf_file)[source]

parse a conf_filefor connection params

get_password(conn_data)[source]

prompt the user for a password. (should be overwritten if subclassing by a gui)

host = None
password[source]
port = None
reset()

perhaps the user got the password wrong? calling this puts it back to state

set_connection_name(name)[source]

set a readable name for this connection

to_html()[source]

returns an html table to show the params (password hidden)

user = None

Table Of Contents

Previous topic

Connection230Data

Next topic

ConnectionError