'Parse the form value into a dict. The value would be a record
id if coming from the database, or a JSON string when coming
from a form. Should be called from validate(), doesn\'t need to
be re-implemented in subclass.
@param value: the value
@return: the parsed data as dict'

def parse(self, value):

    record_id = None
    values = None
    if value:
        if isinstance(value, basestring):
            if value.isdigit():
                record_id = long(value)
            else:
                try:
                    values = json.loads(value)
                except ValueError:
                    pass
        else:
            record_id = value
    else:
        record_id = None
    if (values is None):
        values = {'id': record_id}
    return values
