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.
| DataEvent | RowNavigation | RowNumChanged |
Application
Read-only object reference to the Dabo Application object. (dApp). (inherited from dObject) |
AutoPopulatePK
Determines if we are using a table that auto-generates its PKs. (bool) (inherited from dBizobj) |
AutoQuoteNames
When True (default), table and column names are enclosed with quotes during SQL creation in the cursor. (bool) (inherited from dBizobj) |
AutoSQL
Returns the SQL statement automatically generated by the sql manager. (inherited from dBizobj) |
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) |
Caption
The friendly title of the cursor, used in messages to the end user. (str) (inherited from dBizobj) |
ChildCacheInterval
If this is a child bizobj, this represents the length of time in seconds that a requery from parent.requeryAllChildren() will be ignored. (int) (inherited from dBizobj) |
Class
The class the object is based on. Read-only. (class) (inherited from dObject) |
Connection
The dConnection object used to connect with the backend database. (inherited from dBizobj) |
CurrentSQL
Returns the current SQL that will be run, which is one of UserSQL or AutoSQL. (inherited from dBizobj) |
DataSource
The title of the cursor. Used in resolving DataSource references. (str) (inherited from dBizobj) |
DataSourceName
If set, treated as cursor real table name where DataSource is an alias for it. This allows coexistence of many business objects with same data source on single form. (str) Example: class StockBase(dBizobj): def initProperties(self): self.DataSourceName = "stock" class StockHigh(StockBase): def initProperties(self): self.DataSource = "stock_high" class StockLow(StockBase): def initProperties(self): self.DataSource = "stock_low" (inherited from dBizobj) |
DataStructure
Returns the structure of the cursor in a tuple of 6-tuples. | 0: field alias (str) | 1: data type code (str) | 2: pk field (bool) | 3: table name (str) | 4: field name (str) | 5: field scale (int or None) This information will try to come from a few places, in order: 1. The explicitly-set DataStructure property 2. The backend table method (inherited from dBizobj) |
DefaultValues
A dictionary specifying default values for fields when a new record is added. The values of the dictionary can be literal (must match the field type), or they can be a function object which will be called when the new record is added to the bizobj. (inherited from dBizobj) |
Encoding
Name of encoding to use for unicode (str) (inherited from dBizobj) |
FillLinkFromParent
In the onNew() method, do we fill in the foreign key field specified by the LinkField property with the value returned by calling the bizobj's getParentPK() method? (bool) (inherited from dBizobj) |
IsAdding
Returns True if the current record is new and unsaved. (inherited from dBizobj) |
KeyField
Name of field that is the PK. If multiple fields make up the key, separate the fields with commas. (str) (inherited from dBizobj) |
LastSQL
Returns the last executed SQL statement. (inherited from dBizobj) |
LinkField
Name of the field that is the foreign key back to the parent. (str) (inherited from dBizobj) |
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 of the object. (str) (inherited from dObject) |
NewChildOnNew
Should new child records be added when a new parent record is added? (bool) (inherited from dBizobj) |
NewRecordOnNewParent
If this bizobj's parent has NewChildOnNew==True, do we create a record here? (bool) (inherited from dBizobj) |
NonUpdateFields
Fields in the cursor to be ignored during updates (inherited from dBizobj) |
Parent
Reference to the parent bizobj to this one. (dBizobj) (inherited from dObject) |
ParentLinkField
Name of the field in the parent table that is used to determine child records. If empty, it is assumed that the parent's PK is used (str) (inherited from dBizobj) |
PreferenceManager
Reference to the Preference Management object (dPref) (inherited from dObject) |
Record
Represents a record in the data set. You can address individual columns by referring to 'self.Record.fieldName' (read-only) (no type) (inherited from dBizobj) |
RequeryChildOnSave
Do we requery child bizobjs after a save()? (bool) (inherited from dBizobj) |
RequeryChildrenOnNavigate
Do we requery child bizobjs when navigating records? (bool) Usually, you want to automatically requery children when the parent RowNumber changes. However, there may be cases when you want to do that requery manually at the proper time instead for performance reasons. Setting this property to False will keep requeryAllChildren() from automatically running after RowNumber changes. (inherited from dBizobj) |
RequeryOnLoad
When True, the cursor object runs its query immediately. This is useful for lookup tables or fixed-size (small) tables. (bool) (inherited from dBizobj) |
RequeryWithParent
Specifies whether a child bizobj gets requeried automatically. When True (the default) moving the record pointer or requerying the parent bizobj will result in the child bizobj's getting requeried as well. When False, user code will have to manually call child.requery() at the appropriate time. (inherited from dBizobj) |
RestorePositionOnRequery
After a requery, do we try to restore the record position to the same PK? (inherited from dBizobj) |
RowCount
The number of records in the cursor's data set. It will be -1 if the cursor hasn't run any successful queries yet. (int) (inherited from dBizobj) |
RowNumber
The current position of the record pointer in the result set. (int) (inherited from dBizobj) |
SQL
DEPRECATED. Equivalent to UserSQL. (str) (inherited from dBizobj) |
SaveNewUnchanged
Specifies whether new unchanged records are saved. (bool; default:False) (inherited from dBizobj) |
ScanRequeryChildren
When calling the scan() function, this property determines if we requery any child bizobjs for each row in this bizobj. The default is False, as this has the potential to cause performance issues. (bool) (inherited from dBizobj) |
ScanRestorePosition
After running a scan, do we attempt to restore the record position to where it was before the scan (True, default), or do we leave the pointer at the end of the recordset (False). (bool) (inherited from dBizobj) |
ScanReverse
Do we scan the records in reverse order? (Default: False) (bool) (inherited from dBizobj) |
SqlManager
Reference to the cursor that handles SQL Builder information (cursor) (inherited from dBizobj) |
UserSQL
SQL statement to run. If set, the automatic SQL builder will not be used. (inherited from dBizobj) |
VirtualFields
A dictionary mapping virtual_field_name to function to call. The specified function will be called when getFieldVal() is called on the specified virtual field name. (inherited from dBizobj) |
|
DataEvent |
RowNavigationOccurs when the PrimaryBizobj of the dForm is being navigated. As the user is rapidly calling dForm.next(), .prior(), etc., RowNavigation events get raised. Your code should do some quick display updates to indicate to the user that the record is changing, but the child bizobj's won't be requeried until after the navigation has ended. See also RowNumChanged, which only occurs after the user has settled on a record and has stopped navigating. |
RowNumChangedOccurs when the RowNumber of the PrimaryBizobj of the dForm has changed. |
addChild(self, child)
Add the passed child bizobj to this bizobj. Child bizobjs stay in sync with their parent, getting requeried at the appropriate times. (inherited from dBizobj) |
addField(self, exp, alias=None)
Add a field to the field clause. (inherited from dBizobj) |
addFrom(self, exp, alias=None)
Add a table to the sql statement. For 1-M joins, use the addJoin() method. For M-M joins, use the createAssociation() method. (inherited from dBizobj) |
addGroupBy(self, exp)
Add an expression to the group-by clause. (inherited from dBizobj) |
addJoin(self, tbl, exp, joinType=None)
Add SQL JOIN clause. :param tbl: the name of the table to join with :param exp: the join expression :param joinType: examples: "LEFT", "RIGHT", "INNER", "OUTER" (inherited from dBizobj) |
addMMBizobj(self, mmBizobj, assocTable, assocPKColThis, assocPKColOther, mmPkCol=None)
Add the passed bizobj to this bizobj in a Many-to-Many relationship. The reference will be stored, and the Parent reference of that bizobj will be set to this. If mmPkCol is not specified, the KeyField for the mmBizobj will be used for the relationship. (inherited from dBizobj) |
addOrderBy(self, exp)
Add an expression to the order-by clause. (inherited from dBizobj) |
addWhere(self, exp, comp='and')
Add a filter expression to the where clause. (inherited from dBizobj) |
afterCancel(self)
Hook method called after the changed records are canceled.. (inherited from dBizobj) |
afterChange(self)
Hook method called after a record is changed. This hook will be called after a successful save() or delete(). Contrast with the afterSave() hook which only gets called after a save(), and the afterDelete() which is only called after a delete(). (inherited from dBizobj) |
afterChildRequery(self)
Hook method called after the child bizobjs are requeried. (inherited from dBizobj) |
afterCreateCursor(self, crs)
This hook is called after the underlying cursor object is created. The crs argument will contain the reference to the newly-created cursor. (inherited from dBizobj) |
afterDelete(self)
Hook method called after a record is deleted. (inherited from dBizobj) |
afterDeleteAllChildren(self)
Hook method called after all child records are deleted. (inherited from dBizobj) |
afterFirst(self)
Hook method called after navigating to the next record. (inherited from dBizobj) |
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) |
afterLast(self)
Hook method called after navigating to the last record. (inherited from dBizobj) |
afterNew(self)
Hook method called after a new record is added. Use this hook to change field values of newly added records. If you change field values here, the memento system will catch it and prompt you to save if needed later on. If you want to change field values and not trigger the memento system, override onNew() instead. (inherited from dBizobj) |
afterNext(self)
Hook method called after navigating to the next record. (inherited from dBizobj) |
afterPointerMove(self)
Hook method called after the record pointer moves. (inherited from dBizobj) |
afterPrior(self)
Hook method called after navigating to the prior record. (inherited from dBizobj) |
afterRequery(self)
Hook method called after the cursor is requeried. (inherited from dBizobj) |
afterSave(self)
Hook method called after the current record is saved.. (inherited from dBizobj) |
afterSaveAll(self)
Hook method called after all the the changed records are saved.. (inherited from dBizobj) |
afterSetCurrentParent(self)
Hook method called after the parent cursor changes. (inherited from dBizobj) |
afterSetFieldVal(self, fld, row)
Hook method called after a field's value has been set. Your hook method needs to accept two arguments: | -> fld : The name of the changed field. | -> row : The RowNumber of the changed field. If row is None, this is the common case of the change happening in the current row. Note that this hook will only fire if the new field value is different from the old. (inherited from dBizobj) |
afterSetRowNumber(self)
Hook method called after the RowNumber property is set. (inherited from dBizobj) |
appendDataSet(self, ds, updateInternals=False)
Appends the rows in the passed dataset to this bizobj's dataset. No checking is done on the dataset columns to make sure that they are correct for this bizobj; it is the responsibility of the caller to make sure that they match. If invalid data is passed, a dException.FieldNotFoundException will be raised. (inherited from dBizobj) |
applyDiffAndSave(self, diff, primary=False)
Diffs are dicts in the format:
{hashval: (DataSource, KeyField, [changes])}
where 'changes' is a list of dicts; one for each changed row in
the bizobj. Each row dict has the following key/value pairs:
KeyField: pk value
ColumnName: (origVal, newVal)
Column2Name: (origVal, newVal)
...
The 'diff' dict we receive can have 1 or two keys. One that will always
be present is the hashval for this bizobj. If this bizobj has related child
bizobjs, and they have changes, there will be a 'children' key that will
contain a list of one diff for each child bizobj with changes.
If this is the primary bizobj called from the web server, the 'primary'
parameter will be true, meaning that this bizobj will handle transactions.
|
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) |
beforeCancel(self)
Hook method called before the changed records are canceled.. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeChildRequery(self)
Hook method called before the child bizobjs are requeried. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeCreateCursor(self)
Hook method called before the underlying cursor object is created. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
| beforeDelete(self) |
beforeDeleteAllChildren(self)
Hook method called before all child records are deleted. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeFirst(self)
Hook method called before navigating to the next record. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
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) |
beforeLast(self)
Hook method called before navigating to the last record. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeNew(self)
Hook method called before a new record is added. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeNext(self)
Hook method called before navigating to the next record. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforePointerMove(self)
Hook method called before the record pointer moves. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforePrior(self)
Hook method called before navigating to the prior record. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeRequery(self)
Hook method called before the cursor is requeried. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeSave(self)
Hook method called before the current record is saved.. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeSaveAll(self)
Hook method called before all the changed records are saved.. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beforeSetRowNumber(self)
Hook method called before the RowNumber property is set. Subclasses can put in additional code to run, and/or return a non-empty string to signify that the action should not happen. The contents of the string will be displayed to the user. (inherited from dBizobj) |
beginTransaction(self, crs=None)
Attempts to begin a transaction at the database level, and returns True/False depending on its success. (inherited from dBizobj) |
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) |
bizDataIterator(self, reversed=False, restorePointer=False)
Returns an iterator that moves the bizobj's record pointer from the first record to the last, and returns a dict of the columns/values of the record for the current iteration. If you pass 'reversed=True', the iterator will go in reverse order, from the last record to the first. Note that the bizobj will remain on the last (or first, if reverse() is True) record after the iteration is complete unless you call this with restorePointer=True. (inherited from dBizobj) |
bizIterator(self, reversed=False, restorePointer=False)
Returns an iterator that moves the bizobj's record pointer from the first record to the last, and returns the current record number. If you pass 'reversed=True', the iterator will go in reverse order, from the last record to the first. Note that the bizobj will remain on the last (or first, if reverse() is True) record after the iteration is complete unless you call this with restorePointer=True. (inherited from dBizobj) |
cacheExpired(self)
This controls if a child requery is needed when a parent is requeried. (inherited from dBizobj) |
cancel(self, ignoreNoRecords=None, cancelTheChildren=True)
Cancel all changes to the current record and by default all children. Two hook methods will be called: beforeCancel() and afterCancel(). The former, if it returns an error message, will raise an exception and not continue cancelling the record. (inherited from dBizobj) |
cancelAll(self, ignoreNoRecords=None, cancelTheChildren=True)
Cancel all changes made in all rows, including by default all children and all new, unmodified records. (inherited from dBizobj) |
cloneRecord(self)
Creates a copy of the current record and adds it to the dataset. The KeyField is not copied. (inherited from dBizobj) |
commitTransaction(self, crs=None)
Attempts to commit a transaction at the database level, and returns True/False depending on its success. (inherited from dBizobj) |
createAssociation(self, mmOtherTable, mmOtherPKCol, assocTable, assocPKColThis, assocPKColOther)
Create a many-to-many association. Generally it is better to use the 'addMMBizobj()' method, but if you want to set this manually, use this instead of defining the JOINs. :param mmOtherTable: the name of the table for the other half of the MM relation :param mmOtherPKCol: the name of the PK column in the mmOtherTable :param assocTable: the name of the table holding the association between the two :param assocPKColThis: the name of the column in the association table for this PK :param assocPKColOther: the name of the column in the association table for the other PK (inherited from dBizobj) |
createCursor(self, key=None, addToCursorCollection=True)
Create the cursor that this bizobj will be using for data, and optionally store it in the dictionary for cursors, with the passed value of 'key' as its dict key. For independent bizobjs, that key will be None. If creating a cursor that will not be used as a data source for this bizobj, as when creating many-to-many cursors, pass False for the 'addToCursorCollection' parameter. Subclasses should override beforeCreateCursor() and/or afterCreateCursor() instead of overriding this method, if possible. Returning any non-empty value from beforeCreateCursor() will prevent the rest of this method from executing. (inherited from dBizobj) |
dataToXML(self)
Returns XML representing the data set. If there are child bizobjs, the data for the related child records will be nested inside of the parent record; this nesting can go as many levels deep as there are child/grandchild/etc. bizobjs. (inherited from dBizobj) |
defineConnection(self)
You must define and create the connection in this method. Otherwise an error will be raised. Pass the connection information to setConnectionParams(); if you are using a .cnxml file, pass that in the 'cxnfile' parameter; otherwise, use the various connection setting params to define the connection. NOTE: You must use a SINGLE-CONNECTION .cnxml file; if multiple connections are defined, there is no way for the bizobj to know which one you want to use. |
delete(self, startTransaction=True, inLoop=False)
Delete the current row of the data set. (inherited from dBizobj) |
deleteAll(self, startTransaction=True)
Delete all rows in the data set. (inherited from dBizobj) |
deleteAllChildren(self, startTransaction=True)
Delete all children associated with the current record without deleting the current record in this bizobj. (inherited from dBizobj) |
escQuote(self, val)
Escape special characters in SQL strings. Escapes any single quotes that could cause SQL syntax errors. Also escapes backslashes, since they have special meaning in SQL parsing. Finally, wraps the value in single quotes. (inherited from dBizobj) |
execute(self, sql, params=None)
Execute the sql on the cursor. Dangerous. Use executeSafe instead. (inherited from dBizobj) |
executeSafe(self, sql, params=None)
Execute the passed SQL using an auxiliary cursor. This is considered 'safe', because it won't harm the contents of the main cursor. (inherited from dBizobj) |
expireCache(self, recurse=True, _allCursors=False)
Expire the requery cache so that a subsequent self.Parent.requeryAllChildren() will fetch records from the backend instead of using the cached records. If recurse is True, the cache in the child bizobjs will be expired, too. (inherited from dBizobj) |
fieldValidation(self, fld, val)
This is called by the form when a control that is marked for field- level validation loses focus. It handles communication between the bizobj methods and the form. When creating Dabo apps, if you want to add field-level validation rules, you should override fieldValidation() with your specific code. (inherited from dBizobj) |
filter(self, fld, expr, op='=')
This takes a field name, an expression, and an optional operator, and applies that to the current dataset. The original dataset is preserved; calling removeFilter() will remove the last filter applied to the bizobj. If the current record is in the filtered dataset, that record will still be current; if it is filtered out, the current row will be row 0. If the operator is specified, it will be used literally in the evaluation instead of the equals sign, unless it is one of the following strings, which will be interpreted as indicated: | eq, equals: = | ne, nequals: != | gt: > | gte: >= | lt: < | lte: <= | startswith, beginswith: fld.startswith(expr) | endswith: fld.endswith(expr) | contains: expr in fld (inherited from dBizobj) |
filterByExpression(self, expr)
Allows you to filter by any valid Python expression.
Use the field alias names, for example::
biz.filterByExpression('cust_name[0].lower() = 'a')
where cust_name is a field alias name in this record.
(inherited from dBizobj) |
first(self)
Move to the first record of the data set. Any child bizobjs will be requeried to reflect the new parent record. If there are no records in the data set, an exception will be raised. (inherited from dBizobj) |
formatDateTime(self, val)
Wrap a date or date-time value in the format required by the backend. (inherited from dBizobj) |
formatForQuery(self, val)
Wrap up any value(int, long, string, date, date-time, decimal, none) for use to be in a query. (inherited from dBizobj) |
getAbsoluteName(self)
Return the fully qualified name of the object. (inherited from dObject) |
getAncestorByDataSource(self, ds)
Given a DataSource, finds the ancestor (parent, grandparent, etc.) of this bizobj that has that DataSource. If no such ancestor exists, returns None. (inherited from dBizobj) |
getChangedRows(self, includeNewUnchanged=False)
Returns a list of row numbers for which isChanged() returns True. The changes may therefore not be in the record itself, but in a dependent child record. If includeNewUnchanged is True, the presence of a new unsaved record that has not been modified from its defaults will suffice to mark the record as changed. (inherited from dBizobj) |
getChangedStatus(self, ret=None)
Returns a dictionary of bizobj references and the results of getRecordStatus() on each changed row. Use to easily inspect the current dirty records in the hierarchy. (inherited from dBizobj) |
getChildByDataSource(self, dataSource)
Return a reference to the child bizobj with the passed dataSource. (inherited from dBizobj) |
getChildren(self)
Return a tuple of the child bizobjs. (inherited from dBizobj) |
getDataDiff(self, allRows=False)
Get a dict that is keyed on the hash value of this bizobj, with the value being a list of record changes. Default behavior is to only consider the current row; you can change that by passing allRows=True. Each changed row will be present in the diff, with its PK and any columns whose values have changed. If there are any related child bizobjs, their diffs will be added to the dict under the key 'children' so that they can be processed accordingly. (inherited from dBizobj) |
getDataSet(self, flds=(), rowStart=0, rows=None, returnInternals=False)
Get the entire data set encapsulated in a list. If the optional 'flds' parameter is given, the result set will be filtered to only include the specified fields. rowStart specifies the starting row to include, and rows is the number of rows to return. (inherited from dBizobj) |
getDataStructure(self)
Gets the structure of the DataSource table. Returns a list
of 3-tuples, where the 3-tuple's elements are:
| 0: the field name (string)
| 1: the field type ('I', 'N', 'C', 'M', 'B', 'D', 'T')
| 2: boolean specifying whether this is a pk field.
(inherited from dBizobj) |
getDataStructureFromDescription(self)
Gets the structure of the DataSource table. Returns a list
of 3-tuples, where the 3-tuple's elements are:
| 0: the field name (string)
| 1: the field type ('I', 'N', 'C', 'M', 'B', 'D', 'T')
| 2: boolean specifying whether this is a pk field.
(inherited from dBizobj) |
getDataTypeForField(self, fld)
Given a field name, returns its Python type, or None if no DataStructure information is available. (inherited from dBizobj) |
getDataTypes(self)
Returns the field type definitions as set in the cursor. (inherited from dBizobj) |
getFieldClause(self)
Returns the current field clause set in the backend. (inherited from dBizobj) |
getFieldNames(self)
Returns a tuple of all the field names in the cursor. (inherited from dBizobj) |
getFieldVal(self, fld, row=None, _forceNoCallback=False)
Return the value of the specified field in the current or specified row. (inherited from dBizobj) |
getFieldVals(self, row=None)
Return a dict of the field/value pairs in the current or specified row. (inherited from dBizobj) |
getFromClause(self)
Returns the current from clause set in the backend. (inherited from dBizobj) |
getGroupByClause(self)
Returns the current group-by clause set in the backend. (inherited from dBizobj) |
getJoinClause(self)
Returns the current join clause set in the backend. (inherited from dBizobj) |
getLimit(self)
Returns the current limit clause set in the backend. (inherited from dBizobj) |
getLimitClause(self)
Returns the current limit clause set in the backend. (inherited from dBizobj) |
getOrderByClause(self)
Returns the current order-by clause set in the backend. (inherited from dBizobj) |
getPK(self)
Return the value of the PK field. (inherited from dBizobj) |
getParams(self)
Return the parameters to send to the cursor's execute method. This is the place to define the parameters to be used to modify the SQL statement used to produce the record set. Normally if you have known parameters, you would simply call setParams(<param tuple>). But in cases where the parameter values need to be dynamically calculated, override this method in your subclass to determine the tuple to return. (inherited from dBizobj) |
getParentLinkValue(self)
Return the value of the parent record on which this bizobj is dependent. Usually this is the PK of the parent, but can be a non-PK field, if this bizobj's ParentLinkField is not empty. (inherited from dBizobj) |
getParentPK(self)
Return the value of the parent bizobjs' PK field. Alternatively, user code can just call self.Parent.getPK(). (inherited from dBizobj) |
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) |
getRecordStatus(self, rownum=None)
Returns a dictionary containing an element for each changed field in the specified record (or the current record if none is specified). The field name is the key for each element; the value is a 2-element tuple, with the first element being the original value, and the second being the current value. (inherited from dBizobj) |
getSQL(self)
Returns the SQL statement currently set in the backend. (inherited from dBizobj) |
getTempCursor(self, sql=None, params=None, requery=True)
Occasionally it is useful to be able to run ad-hoc queries against
the database. For these queries, where the results are not meant to
be managed as in regular bizobj/cursor relationships, a temp cursor
will allow you to run those queries, get the results, and then dispose
of the cursor.
If you send no arguments, you'll get a cursor to use how you want, like::
cur = self.getTempCursor()
cur.UserSQL = "select count(*) as count from invoices where cust_id = ?"
cur.requery((883929,))
invoiceCount = cur.Record.count
But you can also simplify by sending the sql and params in the call::
cur = self.getTempCursor("select count(*) as count...", (883929,))
invoiceCount = cur.Record.count
Note that if you send params, the cursor will be requeried even if
the requery arg is False.
(inherited from dBizobj) |
getWhereClause(self)
Returns the current where clause set in the backend. (inherited from dBizobj) |
getWordMatchFormat(self)
Returns the backend's SQL format for creating queries that are based on matching words in a given column. (inherited from dBizobj) |
hasPK(self, pk)
Return True if the passed PK value is present in the dataset. (inherited from dBizobj) |
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) |
isAnyChanged(self, includeNewUnchanged=None, withChildren=True)
Return True if at least one record in the current record set has been changed. (inherited from dBizobj) |
isChanged(self, includeNewUnchanged=None, withChildren=True)
Return True if data has changed in this bizobj and any children. Only the current record is checked. Call isAnyChanged() to check all records. (inherited from dBizobj) |
isRemote(self)
Returns True/False, depending on whether this bizobj's connection is remote or not. (inherited from dBizobj) |
isRowChanged(self, includeNewUnchanged=None)
Return True if data has changed in the current row of this bizobj, without any children. (inherited from dBizobj) |
last(self)
Move to the last record of the data set. Any child bizobjs will be requeried to reflect the new parent record. If there are no records in the data set, an exception will be raised. (inherited from dBizobj) |
locate(self, val, fld=None, caseSensitive=False, movePointer=True, runRequery=True)
Search for a value in a field, and optionally move the record pointer to the first matching record. Returns the True or False, depending on whether the value was found. If runRequery is True, and the record pointer is moved, all child bizobjs will be requeried, and the afterPointerMove() hook method will fire. This is very similar to the seek() method, with two main differences: there is no concept of a near-match; either the value is found or it isn't; the return value is a boolean indicating if the match was found, not the matching RowNumber. (inherited from dBizobj) |
lookupPKWithAdd(self, field, val)
Runs a lookup in the specified field for the desired value. If found, returns the PK for that record. If not found, a new record is created with the 'field' column populated with 'val', and the new record's PK is returned. None of this affects the current dataset. (inherited from dBizobj) |
mmAddToBoth(self, bizOrDS, thisField, thisVal, otherField, otherVal)
Creates an association in a M-M relationship. If the relationship already exists, nothing changes. Otherwise, this will ensure that both values exist in their respective tables, and will create the entry in the association table. (inherited from dBizobj) |
mmAssociateValue(self, bizOrDS, otherField, otherVal)
Associates the value in the 'other' table of a M-M relationship with the current record in the bizobj. If that value doesn't exist in the other table, it is added. (inherited from dBizobj) |
mmAssociateValues(self, bizOrDS, otherField, listOfValues)
Adds association records so that the current record in this bizobj is associated with every item in listOfValues. Other existing relationships are unaffected. (inherited from dBizobj) |
mmDissociateAll(self, bizOrDS)
Removes all associations between the current record and the associated M-M table. (inherited from dBizobj) |
mmDissociateValue(self, bizOrDS, otherField, otherVal)
Removes the association between the current record and the specified value in the 'other' table of a M-M relationship. If no such association exists, nothing happens. (inherited from dBizobj) |
mmDissociateValues(self, bizOrDS, otherField, listOfValues)
Removes the association between the current record and every item in 'listOfValues' in the 'other' table of a M-M relationship. If no such association exists, nothing happens. (inherited from dBizobj) |
mmGetAssociatedValues(self, bizOrDS, listOfFields)
Given a relationship, returns the values associated with the current record. 'listOfFields' can be either a single field name, or a list of fields in the associated table. (inherited from dBizobj) |
mmSetFullAssociation(self, bizOrDS, otherField, listOfValues)
Adds and/or removes association records so that the current record in this bizobj is associated with every item in listOfValues, and none other. (inherited from dBizobj) |
moveToPK(self, pk)
Move to the row with the specified pk value, or raise RowNotFoundException. (inherited from dBizobj) |
moveToRowNumber(self, rowNumber)
Move to the specified row number. (inherited from dBizobj) |
new(self)
Create a new record and populate it with default values. Default values are specified in the DefaultValues dictionary. (inherited from dBizobj) |
next(self)
Move to the next record of the data set. Any child bizobjs will be requeried to reflect the new parent record. If there are no records in the data set, an exception will be raised. (inherited from dBizobj) |
oldVal(self, fieldName, row=None)
Returns the value that was in the specified field when it was last fetched from the backend. Used to determine if the current value has been modified. (inherited from dBizobj) |
onDeleteLastRecord(self)
Hook called when the last record has been deleted from the data set. (inherited from dBizobj) |
onNew(self)
Called when a new record is added. Use this hook to add additional default field values, or anything else you need. If you change field values here, the memento system will not catch it (the record will not be marked 'dirty'). Use afterNew() if you instead want the memento system to record the changes. (inherited from dBizobj) |
onSaveNew(self)
Hook method called after successfully saving a new record. (inherited from dBizobj) |
prepareWhere(self, clause)
Calls the backend's pre-processing routine for improving efficiency of filter expressions. If the backend does not have this capability, nothing is done. (inherited from dBizobj) |
prior(self)
Move to the prior record of the data set. Any child bizobjs will be requeried to reflect the new parent record. If there are no records in the data set, an exception will be raised. (inherited from dBizobj) |
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) |
removeAllChildren(self)
Remove all child bizobjs. (inherited from dBizobj) |
removeFilter(self)
Remove the most recently applied filter. (inherited from dBizobj) |
removeFilters(self)
Remove all applied filters, going back to the original data set. (inherited from dBizobj) |
removeMMBizobj(self, mmBizobj)
Removes the specified bizobj from a Many-to-Many relationship. If no such relationship exists, nothing happens. (inherited from dBizobj) |
replace(self, field, valOrExpr, scope=None)
Replaces the value of the specified field with the given value or expression. All records matching the scope are affected; if no scope is specified, all records are affected. 'valOrExpr' will be treated as a literal value, unless it is prefixed with an equals sign. All expressions will therefore be a string beginning with '='. Literals can be of any type. (inherited from dBizobj) |
requery(self)
Requery the data set. Refreshes the data set with the current values in the database, given the current state of the filtering parameters. (inherited from dBizobj) |
requeryAllChildren(self, _doRequery=True)
Requery each child bizobj's data set. Called to assure that all child bizobjs have had their data sets refreshed to match the current master row. This will normally happen automatically when appropriate, but user code may call this as well if needed. Note: children will only be requeried if their cache hasn't expired yet. If you want to force all children to requery at the next opportunity, you should call self.expireCache() before calling self.requery() or self.requeryAllChildren(). (inherited from dBizobj) |
rollbackTransaction(self, crs=None)
Attempts to rollback a transaction at the database level, and returns True/False depending on its success. (inherited from dBizobj) |
save(self, startTransaction=True, saveTheChildren=True)
Save any changes that have been made in the current row. If the save is successful, the saveAll() of all child bizobjs will be called as well if saveTheChildren is True (the default). (inherited from dBizobj) |
saveAll(self, startTransaction=True, saveTheChildren=True)
Save changes to all rows in the bizobj, and (by default) the children. (inherited from dBizobj) |
scan(self, func, *args, **kwargs)
Iterate over all records and apply the passed function to each. Set self.exitScan to True to exit the scan on the next iteration. If self.ScanRestorePosition is True, the position of the current record in the recordset is restored after the iteration. If self.ScanRequeryChildren is True, any child bizobjs will be requeried for each row in the bizobj. Only use this if you know the size of the data involved will be small. You may optionally send reverse=True to scan the records in reverse order, which you'll want to do if, for example, you are deleting records in your scan function. If the reverse argument is not sent, self.ScanReverse will be queried to determine the behavior. Returns value from 'func' called in the last iteration. (inherited from dBizobj) |
scanChangedRows(self, func, allCursors=False, includeNewUnchanged=False, *args, **kwargs)
Move the record pointer to each changed row, and call func. If allCursors is True, all other cursors for different parent records will be iterated as well. If includeNewUnchanged is True, new unsaved records that have not been edited from their default values will be counted as 'changed'. If you want to end the scan on the next iteration, set self.exitScan=True. Records are scanned in arbitrary order. Any exception raised by calling func() will be passed up to the caller. (inherited from dBizobj) |
scanRows(self, func, rows, *args, **kwargs)
Iterate over the specified rows and apply the passed function to each. Set self.exitScan to True to exit the scan on the next iteration. (inherited from dBizobj) |
|
scanVirtualFields(self, fld, expr, op)
(inherited from dBizobj) |
seek(self, val, fld=None, caseSensitive=False, near=False, runRequery=True, sort=True, incremental=False)
Search for a value in a field, and move the record pointer to the match. Used for searching of the bizobj's cursor for a particular value in a particular field. Can be optionally case-sensitive. If 'near' is True, and no exact match is found in the cursor, the cursor's record pointer will be placed at the record whose value in that field is closest to the desired value without being greater than the requested value. If runRequery is True, and the record pointer is moved, all child bizobjs will be requeried, and the afterPointerMove() hook method will fire. If sort is True (the default), then we seek to the first matching value without sorting first. If incremental is True (default is False), then we only compare the first characters up until the length of val. Returns the RowNumber of the found record, or -1 if no match found. (inherited from dBizobj) |
setChildLinkFilter(self)
If this is a child bizobj, its record set is dependent on its parent's current PK value. This will add the appropriate WHERE clause to filter the child records. If the parent is a new, unsaved record, or if there is no parent record, there cannot be any child records saved yet, so an empty query is built. (inherited from dBizobj) |
setConnection(self, conn)
Normally connections are established before bizobj creation, but for those cases where connections are created later, use this method to establish the connection used by the bizobj. (inherited from dBizobj) |
| setConnectionParams(self, cxnfile=None, dbType=None, database=None, host=None, user=None, password=None, plainTextPassword=None) |
setCurrentParent(self, val=None)
Lets dependent child bizobjs update to the current parent record. (inherited from dBizobj) |
setFieldClause(self, clause)
Explicitly set the field clause. Replaces any existing field settings. (inherited from dBizobj) |
setFieldVal(self, fld, val, row=None, pk=None)
Set the value of the specified field in the current or specified row. (inherited from dBizobj) |
setFieldVals(self, valDict=None, row=None, pk=None, **kwargs)
Allows you to set the value for multiple fields with one call by passing a dict containing the field names as keys, and the new values as values. (inherited from dBizobj) |
setFromClause(self, clause)
Explicitly set the from clause. Replaces any existing from settings. (inherited from dBizobj) |
setGroupByClause(self, clause)
Explicitly set the group-by clause. Replaces any existing group-by settings. (inherited from dBizobj) |
setJoinClause(self, clause)
Explicitly set the join clauses. Replaces any existing join settings. (inherited from dBizobj) |
setLimit(self, clause)
Explicitly set the limit clause. Replaces any existing limit settings. (inherited from dBizobj) |
setLimitClause(self, clause)
Explicitly set the limit clause. Replaces any existing limit settings. (inherited from dBizobj) |
setOrderByClause(self, clause)
Explicitly set the order-by clause. Replaces any existing order-by settings. (inherited from dBizobj) |
setParams(self, params)
Set the query parameters for the cursor. Accepts a tuple that will be merged with the sql statement using the cursor's standard method for merging. (inherited from dBizobj) |
setParentFK(self, val=None, allRows=True)
Accepts and sets the foreign key value linking to the parent table for all records. (inherited from dBizobj) |
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) |
setSQL(self, sql=None)
Set the SQL query that will be executed upon requery(). This allows you to manually override the sql executed by the cursor. If no sql is passed, the SQL will get set to the value returned by getSQL(). (inherited from dBizobj) |
setValues(self, valDict=None, row=None, pk=None, **kwargs)
Allows you to set the value for multiple fields with one call by passing a dict containing the field names as keys, and the new values as values. (inherited from dBizobj) |
setWhereClause(self, clause)
Explicitly set the where clause. Replaces any existing where settings. (inherited from dBizobj) |
sort(self, col, ordr=None, caseSensitive=True)
Sort the rows based on values in a specified column. Called when the data is to be sorted on a particular column in a particular order. All the checking on the parameters is done in the cursor. (inherited from dBizobj) |
storeRemoteSQL(self, sql)
The web backend uses '~~' as the name enclosure character. Convert that to the correct character for the actual backend. |
storeToCache(self, hashval)
Store data info to the cache for the next time the same bizobj is needed. |
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) |
validateField(self, fld, val)
This is the method to override if you need field-level validation to your app. It will receive the field name and the new value; you can then apply your business rules to determine if the new value is valid. If not, return a string describing the problem. Any non-empty return value from this method will prevent the control's value from being changed. (inherited from dBizobj) |
validateRecord(self)
Hook for subclass business rule validation code. This is the method that you should customize in your subclasses to create checks on the data entered by the user to be sure that it conforms to your business rules. Your validation code should return an error message that describes the reason why the data is not valid; this message will be propagated back up to the UI where it can be displayed to the user so that they can correct the problem. Example:: if not myNonEmptyField: return "MyField must not be blank" It is assumed that we are on the correct record for testing before this method is called. (inherited from dBizobj) |