def execute(self, cmd):
        try:
            if not '-table ' in cmd:
                exec '{0}'.format(cmd)
            else:
                file = None
                table = None

                fields = []
                items = string.split(cmd, ' ')
                invalidParams = []
                table = self.getTable(items[1])
                allowedParams = ['fields', 'file']
                for i in items:
                    if '=' in i and not string.split(i, '=')[0] in allowedParams:
                        try:
                            invalidParams.append(i)
                        except Exception, err:
                            raise Exception('invalid parameter\n{0}'.format(i))
                    else:
                        if i in 'file=':
                            file = os.path.abspath(string.strip(string.split(
                                i, '=')[1]))
                        if 'fields=' in i:
                            for field in string.split(string.split(i, '=')[1], ','):
                                if field in self.db[table].fields:
                                    fields.append(string.strip(field))

                if len(invalidParams) > 0:
                    print('the following parameter(s) is not valid\n{0}'.format(
                        string.join(invalidParams, ',')))
                else:
                    try:
                        self.cmd_table(table, file, fields)
                    except Exception, err:
                        print('could not generate table for table {0}\n{1}'
                              .format(table, err))
        except Exception, err:
            print('sorry, can not do that!\n{0}'.format(err))
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/scripts/cpdb.py/console.execute/swapped operands of `in`