'Restore an item from a item table row. This does not restore
the references (since this can not be done before all items
are restored), must call job.restore_references() to do that
@param row: the item table row'

def restore(self, row):

    xml = current.xml
    self.item_id = row.item_id
    self.accepted = None
    self.permitted = False
    self.committed = False
    tablename = row.tablename
    self.id = None
    self.uid = row.record_uid
    if (row.data is not None):
        self.data = cPickle.loads(row.data)
    else:
        self.data = Storage()
    data = self.data
    if (xml.MTIME in data):
        self.mtime = data[xml.MTIME]
    if (xml.MCI in data):
        self.mci = data[xml.MCI]
    UID = xml.UID
    if (UID in data):
        self.uid = data[UID]
    self.element = etree.fromstring(row.element)
    if row.citems:
        self.load_components = row.citems
    if row.ritems:
        self.load_references = [json.loads(ritem) for ritem in row.ritems]
    self.load_parent = row.parent
    s3db = current.s3db
    try:
        table = s3db[tablename]
    except:
        self.error = current.ERROR.BAD_RESOURCE
        return False
    else:
        self.table = table
        self.tablename = tablename
    original = S3Resource.original(table, self.data, mandatory=self._mandatory_fields())
    if (original is not None):
        self.original = original
        self.id = original[table._id.name]
        if ((not current.response.s3.synchronise_uuids) and (UID in original)):
            self.uid = self.data[UID] = original[UID]
    self.error = row.error
    postprocess = s3db.get_config(self.tablename, 'xml_post_parse')
    if postprocess:
        postprocess(self.element, self.data)
    if (self.error and (not self.data)):
        return False
    return True
