

def clean(self):
    cleaned_data = super(SaveResultsTableForm, self).clean()
    target_table = cleaned_data.get('target_table')
    if (not target_table):
        raise forms.ValidationError(_('Table name is required.'))
    elif (self.db is None):
        raise forms.ValidationError(_('Cannot validate form, db object is required.'))
    else:
        name_parts = target_table.split('.')
        if (len(name_parts) == 1):
            pass
        elif (len(name_parts) == 2):
            (self.target_database, target_table) = name_parts
        else:
            raise forms.ValidationError(_('Invalid table prefix name.'))
        table = None
        try:
            table = self.db.get_table(self.target_database, target_table)
        except Exception:
            cleaned_data['target_table'] = target_table
        if (table is not None):
            raise forms.ValidationError((_('Table %s.%s already exists') % (name_parts.target_database, target_table)))
    return cleaned_data

dataset/ETHPy150Open cloudera/hue/apps/beeswax/src/beeswax/forms.py SaveResultsTableForm.clean/VarMisuse@201/297 `self`->`name_parts`