New API reference documentation is available for testing at http://thewinecellarbook.com/daboDocTestAlt/. Please report any problems or suggestions on the dabo-users mailing list.

Class dConnectInfo

Holder for the properties for connecting to the backend. Each
backend may have different names for properties, but this object
tries to abstract that. The value stored in the Password must be
encrypted in the format set in the app. This class has  'encrypt' and
'decrypt' functions for doing this, or you can set the PlainTextPassword
property, and the class will encypt that value and set the Password
property for you.

You can create it in several ways, like most Dabo objects. First, you
can pass all the settings as parameters to the constructor::

	ci = dConnectInfo(DbType="MySQL", Host="domain.com",
		User="daboUser", PlainTextPassword="secret", Port=3306,
		Database="myData", Name="mainConnection")

Or you can create a dictionary of the various props, and pass that
in the 'connInfo' parameter::

	connDict = {"DbType" : "MySQL", "Host" : "domain.com",
		"User" : "daboUser", "PlainTextPassword" : "secret",
		"Port" : 3306, "Database" : "myData", "Name" : "mainConnection"}
	ci = dConnectInfo(connInfo=connDict)

Or you can create the object and then set the props
individually::

	ci = dConnectInfo()
	ci.DbType = "MySQL"
	ci.Host = "domain.com"
	ci.User = "daboUser"
	ci.PlainTextPassword = "secret"
	ci.Database = "myData"
	ci.Name = "mainConnection"

If you are running a remote app, should set the RemoteHost property instead of Host. The
DbType will be "web".

Properties

Application BaseClass BasePrefKey
Class Crypto Database
DbType Host KeepAliveInterval
LogEvents Name Parent
Password PlainTextPassword Port
PreferenceManager RemoteHost User

Events


Methods

afterInit autoBindEvents beforeInit
bindEvent bindEvents decrypt
encrypt getAbsoluteName getBackendObject
getConnection getDictCursorClass getProperties
initEvents initProperties raiseEvent
revealPW setConnInfo setProperties
setPropertiesFromAtts unbindEvent




Properties

Application
Read-only object reference to the Dabo Application object.  (dApp).

(inherited from dObject)
BaseClass
The base Dabo class of the object. Read-only.  (class)

(inherited from dObject)
BasePrefKey
Base key used when saving/restoring preferences  (str)

(inherited from dObject)
Class
The class the object is based on. Read-only.  (class)

(inherited from dObject)
Crypto
Reference to the object that provides cryptographic services if run
outside of an application.  (varies)
Database
The database name to login to. (str)
DbType
Name of the backend database type.  (str)
Host
The host name or ip address. (str)
KeepAliveInterval
Specifies how often a KeepAlive query should be sent to the server. (int)

Defaults to None, meaning we never send a KeepAlive query. The interval
is expressed in seconds.
LogEvents
Specifies which events to log.  (list of strings)

If the first element is 'All', all events except the following listed events
will be logged.
Event logging is resource-intensive, so in addition to setting this LogEvents
property, you also need to make the following call:

	>>> dabo.eventLogging = True


(inherited from dObject)
Name
The name used to reference this connection. (str)

(inherited from dObject)
Parent
The containing object.  (obj)

(inherited from dObject)
Password
The encrypted password of the user. (str)
PlainTextPassword
Write-only property that encrypts the value and stores that
in the Password property. (str)
Port
The port to connect on (may not be applicable for all databases). (int)
PreferenceManager
Reference to the Preference Management object  (dPref)

(inherited from dObject)
RemoteHost
When running as a web app, this holds the host URL. (str)
User
The user name. (str)



Events




Methods

afterInit(self)
Subclass hook. Called after the object's __init__ has run fully.
Subclasses should place their __init__ code here in this hook, instead of
overriding __init__ directly, to avoid conflicting with base Dabo behavior.

(inherited from dObject)
autoBindEvents(self, force=True)
Automatically bind any on*() methods to the associated event.

User code only needs to define the callback, and Dabo will automatically
set up the event binding. This will satisfy lots of common cases where
you want an object or its parent to respond to the object's events.

To use this feature, just define a method on<EventName>(), or	if you
want a parent container to respond to the event, make a method in the
parent on<EventName>_<object Name or RegID>().

For example::
	
	class MyButton(dabo.ui.dButton):
		def onHit(self, evt):
			print "Hit!"

	class MyPanel(dabo.ui.dPanel):
		def afterInit(self):
			self.addObject(MyButton, RegID="btn1")

		def onHit_btn1(self, evt):
			print "panel: button hit!"

When the button is pressed, you'll see both 'hit' messages because of
auto event binding.

If you want to bind your events explicitly, you can turn off auto event
binding by calling::

	 dabo.autoBindEvents = False

This feature is inspired by PythonCard.

(inherited from EventMixin)
beforeInit(self, *args, **kwargs)
Subclass hook. Called before the object is fully instantiated.
Usually, user code should override afterInit() instead, but there may be
cases where you need to set an attribute before the init stage is fully
underway.

(inherited from dObject)
bindEvent(self, eventClass, function, _auto=False)
Bind a dEvent to a callback function.

(inherited from EventMixin)
bindEvents(self, bindings)
Bind a sequence of [dEvent, callback] lists.

(inherited from EventMixin)
decrypt(self, val)

			
		
encrypt(self, val)

			
		
getAbsoluteName(self)
Return the fully qualified name of the object.

(inherited from dObject)
getBackendObject(self)

			
		
getConnection(self, **kwargs)

			
		
getDictCursorClass(self)

			
		
getProperties(self, propertySequence=(), propsToSkip=(), ignoreErrors=False, *propertyArguments)
Returns a dictionary of property name/value pairs.

If a sequence of properties is passed, just those property values
will be returned. Otherwise, all property values will be returned.
The sequence of properties can be a list, tuple, or plain string
positional arguments. For instance, all of the following are
equivilent::

	print self.getProperties("Caption", "FontInfo", "Form")
	print self.getProperties(["Caption", "FontInfo", "Form"])
	t = ("Caption", "FontInfo", "Form")
	print self.getProperties(t)
	print self.getProperties(\*t)

An exception will be raised if any passed property names don't
exist, aren't actual properties, or are not readable (do not have
getter functions).

However, if an exception is raised from the property getter function,
the exception will get caught and used as the property value in the
returned property dictionary. This allows the property list to be
returned even if some properties can't be evaluated correctly by the
object yet.

(inherited from PropertyHelperMixin)
initEvents(self)
Hook for subclasses. User code should do custom event binding
here, such as::
	
	self.bindEvent(dEvents.GotFocus, self.customGotFocusHandler)
	

(inherited from dObject)
initProperties(self)
Hook for subclasses. User subclasses should set properties
here, such as::
	
	self.Name = "MyTextBox"
	self.BackColor = (192,192,192)
	

(inherited from dObject)
raiseEvent(self, eventClass, uiEvent=None, *args, **kwargs)
Send the event to all registered listeners.

If uiEvent is sent, dEvents.Event will be able to parse it for useful
information to send along to the callback. 

Additional arguments, if any, are sent along to the constructor	of the
event. While this feature exists so that UI-lib event handlers can pass
along information (such as the keystroke information in a key event), user
code may pass along additional arguments as well, which	will exist in the
event.EventData dictionary property.

In most cases, user code should call raiseEvent() with
the event class (dEvents.Hit, for example) as the only parameter.

(inherited from EventMixin)
revealPW(self)

			
		
setConnInfo(self, connInfo, nm='')

			
		
setProperties(self, propDict={}, ignoreErrors=False, **propKw)
Sets a group of properties on the object all at once.

You have the following options for sending the properties:
	
	1) Property/Value pair dictionary
	2) Keyword arguments
	3) Both

The following examples all do the same thing::

	self.setProperties(FontBold=True, ForeColor="Red")
	self.setProperties({"FontBold": True, "ForeColor": "Red"})
	self.setProperties({"FontBold": True}, ForeColor="Red")


(inherited from PropertyHelperMixin)
setPropertiesFromAtts(self, propDict={}, ignoreExtra=True, context=None)
Sets a group of properties on the object all at once. This
is different from the regular setProperties() method because
it only accepts a dict containing prop:value pairs, and it
assumes that the value is always a string. It will convert
the value to the correct type for the property, and then set
the property to that converted value. If the value needs to be evaluated
in a specific namespace, pass that as the 'context' parameter.

(inherited from PropertyHelperMixin)
unbindEvent(self, eventClass=None, function=None)
Remove a previously registered event binding.

Removes all registrations that exist for the given binding for this
object. If event is None, all bindings for the passed function are
removed. If function is None, all bindings for the passed event are
removed. If both event and function are None, all event bindings are
removed.

(inherited from EventMixin)

Dabo 0.9.4 (rev. 7089)
9 Feb 2012 23:31:09