Products.MightyCal.DataEntry.DataEntryTransaction (version 1.17)
index
/home/zope/lib/python/Products/MightyCal/DataEntry/DataEntryTransaction.py

DataEntryTransaction object:  A temporary holding spot for the data that a user enters in the
process of creating an Event or updating a current one.  A DataEntryTransaction object is created
when the user requests the creation of a new Event, or requests to edit a current Event.  The
DataEntryTransaction is filled with slots for each of the DataTypes that its corresponding
EventType needs, and these slots are filled with default data values (for a new Event) or the
current values of the Event (for an edit).
 
WidgetMakers use DataEntryTransactions to paint the widgets they create.  Instead of doing directly
to the DataType object that contains the current data, the current field value is looked up in the
DataEntryTransaction object.  In addition, in the case that a previous attempt to submit this
data has failed, the field in the DataEntryTransaction will be marked with an error flag and message,
and the WidgetMaker can style its resulting widget appropriate to indicate the erroneous value.
 
When the user submits a form in a user agent, the form's values are reassembled into complete
field values by means of the WidgetMaker that produced the edit widgets to begin with.  These
reassembled values are placed into the DataEntryTransaction, when is then submitted to the EventType
for validation.  Any invalid fields are marked as such, and also have the corresponding error message
associated with them.
 
If a DataEntryTransaction is found to be valid, an Event object is obtained (either the one that is
to be updated, or a new empty one), and the Event and the DataEntryTransaction object are given to the
EventType for setting the new values in the Event object.  A success flag is then returned to the
routine that handles interacting with the user agent, so that it can paint an appropriate Success screen.
In addition, the DataEntryTransaction is marked as "terminated", so that it can eventually be deleted from
the TempFolder that is resides in (a ZCron job handles doing this periodically).
 
If a DataEntryTransaction is found to be invalid, a failure flag is sent back to the routine that
communicates with the user agent.  An appropriate failure screen can be printed, or else the user
can be redirected back to the Edit screen, with the bad fields highlighted.  The ID of the current
DataEntryTransaction is embedded in the form values of this Edit screen, so that when the user re-submits
the page, the DataEntryTransaction can be looked up and updated with the corrected values, and
revalidated, as in the process described above.

 
Modules
            
Dumper

 
Classes
            
Products.MightyCal.EventCatalog.EventSnapshot.EventSnapshot
DataEntryTransaction(Products.MightyCal.EventCatalog.EventSnapshot.EventSnapshot, Products.MightyCal.SItem.SItem)
exceptions.Exception
TerminatedTransactionException
Products.MightyCal.SItem.SItem(OFS.SimpleItem.Item, Acquisition.Acquirer, Acquisition.ExplicitAcquirer, OFS.PropertyManager.PropertyManager, Persistence.Persistent, AccessControl.Role.RoleManager)
DataEntryTransaction(Products.MightyCal.EventCatalog.EventSnapshot.EventSnapshot, Products.MightyCal.SItem.SItem)

 
class DataEntryTransaction
      A class that holds the field structure of a user-defined DataEntryTransaction type
 
  
__init__(self, eventType, eventId, userAgent, REQUEST=None)
DataEntryTransaction constructor
getErrorMessage(self, fieldId)
Retrieves the latest error message for the specified field.
getRecommendedWidget(self, fieldId)
Retrieves the widget recommended by the DataType of the specified field.
getWidget(self, fieldId)
Fetches a widget for the requested field, as generated by our current WidgetMaker
isValid(self, fieldId=None)
Returns TRUE if the transaction/field is valid, false otherwise
populateEvent(self, event)
Given an existing Event, repopulate its fields with the values in the Transaction
setFieldInvalid(self, fieldId, errorMessage)
Used by an external validation routine to mark a particular field as Invalid, as well as to change the overall DataEntryTransaction validity status
setTransactionTerminated(self)
Marks the DataEntryTransaction as having been completed; i.e. the Event got successfully updated, or else the update/creation was canceled.  Setting this flag was cause the DataEntryTransaction object to be deleted on the next cleaning of the TempFolder.
setValuesFromRequest(self, params)
Given the user's HTTP or XMLRPC submission, parse the raw input into complete values and set the various fields of the DataEntryTransaction with the new values.
setupNewEvent(self, event)
Given a pristine Event object, set up its Properties and Id according to the values in the Transaction.
startValidation(self)
Tell the DataEntryTransaction object to reset its validity indicator in preparation for running a new validation routine on its component fields.  Individual fields are set to 'Valid' and must be marked Invalid by the external validation routine.

 
class TerminatedTransactionException
      # InvalidTransactionExceptions are raised when an invalid Transaction attempts to update # or create a new Event object
 
  
__init__(self, trans)
__str__(self)

 
Data
             CHECKBOX_WIDGET = 'CheckboxWidget'

COCOON_HTML_WIDGET_MAKER = 'CocoonHTMLWidgetMaker'

COMMAND_PARAM = 'command'

DATA_ENTRY_TRANSACTION = 'DataEntryTransaction'

DATE_WIDGET = 'DateWidget'

EDITOR_SEPARATOR_CELL_CLASS = 'event-edit-separator-cell'

EDITOR_TITLE_CELL_CLASS = 'event-edit-title-cell'

EDITOR_VALUE_CELL_CLASS = 'event-edit-value-cell'

EVENT_EDIT_DTML_METHOD = 'event_entry'

EVENT_ID_PARAM = 'eventId'

EVENT_OBJECT = 'Event'

EVENT_TYPE_PARAM = 'eventType'

FALSE = 0

FIELD_ID_PARAM = 'fieldId'

FIELD_VALUE_PARAM = 'fieldValue'

GET_FIELD_IDS_COMMAND = 'get-field-ids'

GET_HIDDEN_INPUT_COMMAND = 'get-hidden-input'

GET_TRANSACTION_COMMAND = 'get-transaction'

GET_WIDGET_COMMAND = 'get-widget'

INFO = 0

LABEL_FIELD = 'label'

LIST_WIDGET = 'ListWidget'

MEMO_WIDGET = 'MemoWidget'

NEW_EVENT_ID = 'newEvent'

PROP_EDITORS = 'PropEditors'

RADIO_WIDGET = 'RadioWidget'

RESULT_BAD_COMMAND_ERROR = '501'

RESULT_INTERNAL_ERROR = '500'

RESULT_OK = '200'

RESULT_PERMISSION_ERROR = '300'

RESULT_STATUS_SLOT = 'status'

RESULT_VALIDATION_ERROR = '400'

RESULT_VALUE_SLOT = 'return-value'

SELECT_WIDGET = 'SelectWidget'

STYLE_BASE = 'StyleBase'

STYLE_FOR_ERROR = 'StyleForError'

SUBMIT_TRANSACTION_COMMAND = 'submit'

TEXT_WIDGET = 'TextWidget'

TRANSACTION_ID_PARAM = 'transId'

TRUE = 1

TR_TAG = 'tr'

USER_AGENT_PARAM = 'user-agent'

VALUE_FIELD = 'value'

WIDGET_MAKER_BASE = 'WidgetMaker'

WIDGET_MAKER_REGISTRY = 'WidgetMakerRegistry'

ZOPE_WIDGET_MAKER = 'ZopeWidgetMaker'

__file__ = '/home/zope/lib/python/Products/MightyCal/DataEntry/DataEntryTransaction.pyc'

__name__ = 'Products.MightyCal.DataEntry.DataEntryTransaction'

__version__ = '$Revision: 1.17 $'