log = logging.getLogger(__name__)
+
class NoTableError(Error):
'''No table uploaded'''
def __init__(self, e, descr='', detail=''):
super(NoTableError, self).__init__(e, descr, detail)
+
class BadTableError(Error):
'''Supplied name does not work for a table or view'''
def __init__(self, e, descr='', detail=''):
super(BadTableError, self).__init__(e, descr, detail)
+
class MissingTableError(BadTableError):
'''The supplied table or view does not exist'''
def __init__(self, e, descr='', detail=''):
super(MissingTableError, self).__init__(e, descr, detail)
+
class MissingSchemaError(BadTableError):
'''The schema portion of the supplied table or view does not exist'''
def __init__(self, e, descr='', detail=''):
super(MissingSchemaError, self).__init__(e, descr, detail)
+
class CannotInsertError(BadTableError):
'''Cannot insert into the supplied table or view'''
def __init__(self, e, descr='', detail=''):
super(CannotInsertError, self).__init__(e, descr, detail)
+
class BadHeadersError(Error):
'''The headers in the uploaded file are bad.'''
def __init__(self, e, descr='', detail=''):
errors.append(NoTableError('No table or view name supplied'))
self.double_validator(errors)
-
+
return errors
def write(self, result, errors):
insert_stmt += col_sep + col_name
value_string += col_sep + '%s'
col_sep = ', '
-
+
if bad_cols:
detail = (('<p>The following columns are not in the ({0})'
' table or you do not have permission to access'