diff options
| author | Christophe Simonis <christophe@tinyerp.com> | 2008-07-22 16:24:36 +0200 |
|---|---|---|
| committer | Christophe Simonis <christophe@tinyerp.com> | 2008-07-22 16:24:36 +0200 |
| commit | 2dd9723b8b3d38df8c8962300ab67afffa5cdaaa (patch) | |
| tree | 13dbea91b265af5ad775af16efcdef4ae6ef962c /doc | |
| parent | c5c7c2ef07b346b72eb5a48d6e8cc7a433fba2e8 (diff) | |
convert tabs to 4 spaces
bzr revid: christophe@tinyerp.com-20080722142436-143iu4ryy47w3av0
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/migrate/3.3.0-3.4.0/post.py | 46 | ||||
| -rw-r--r-- | doc/migrate/3.3.0-3.4.0/pre.py | 64 | ||||
| -rw-r--r-- | doc/migrate/3.4.0-4.0.0/post-tiny.py | 18 | ||||
| -rw-r--r-- | doc/migrate/3.4.0-4.0.0/post.py | 28 | ||||
| -rw-r--r-- | doc/migrate/3.4.0-4.0.0/pre-tiny.py | 58 | ||||
| -rw-r--r-- | doc/migrate/3.4.0-4.0.0/pre.py | 68 | ||||
| -rw-r--r-- | doc/migrate/4.0.0-4.2.0/pre.py | 130 | ||||
| -rw-r--r-- | doc/migrate/4.0.0-4.2.0/tiny/pre-tiny.py | 94 | ||||
| -rw-r--r-- | doc/migrate/4.2.0-4.4.0/pre.py | 36 | ||||
| -rw-r--r--[-rwxr-xr-x] | doc/tests/check_profile_l10n_all.py | 114 |
10 files changed, 328 insertions, 328 deletions
diff --git a/doc/migrate/3.3.0-3.4.0/post.py b/doc/migrate/3.3.0-3.4.0/post.py index cc99e3732c2..6983bfad519 100644 --- a/doc/migrate/3.3.0-3.4.0/post.py +++ b/doc/migrate/3.3.0-3.4.0/post.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -91,23 +91,23 @@ cr.execute("SELECT c.relname FROM pg_class c, pg_attribute a WHERE c.relname='re partners=[] drop_payment_term=False if cr.rowcount: - drop_payment_term=True - cr.execute("select id, payment_term from res_partner where payment_term is not null") - partners = cr.dictfetchall() + drop_payment_term=True + cr.execute("select id, payment_term from res_partner where payment_term is not null") + partners = cr.dictfetchall() # loop over them for partner in partners: - value = 'account.payment.term,%d' % partner['payment_term'] - res_id = 'res.partner,%d' % partner['id'] - cr.execute( - "insert into ir_property(name, value, res_id, company_id, fields_id) "\ - "values(%s, %s, %s, %d, %d)", - ('property_payment_term', value, res_id, company_id, fields_id)) + value = 'account.payment.term,%d' % partner['payment_term'] + res_id = 'res.partner,%d' % partner['id'] + cr.execute( + "insert into ir_property(name, value, res_id, company_id, fields_id) "\ + "values(%s, %s, %s, %d, %d)", + ('property_payment_term', value, res_id, company_id, fields_id)) # remove the field if drop_payment_term: - cr.execute("alter table res_partner drop column payment_term") + cr.execute("alter table res_partner drop column payment_term") cr.execute("delete from ir_model_fields where model = 'res.partner' and name = 'payment_term'") cr.commit() @@ -124,10 +124,10 @@ registered_reports = cr.fetchall() reg_reports_ids = ','.join([str(id) for (id,) in registered_reports]) for report in reports_wh_duplicates: - cr.execute("select id from ir_act_report_xml where model=%s and report_name=%s and id not in ("+reg_reports_ids+")", (report['model'], report['report_name'])) - (id,) = cr.fetchone() - cr.execute("delete from ir_act_report_xml where id=%d", (id,)) - cr.execute("delete from ir_values where value='ir.actions.report.xml,%d'", (id,)) + cr.execute("select id from ir_act_report_xml where model=%s and report_name=%s and id not in ("+reg_reports_ids+")", (report['model'], report['report_name'])) + (id,) = cr.fetchone() + cr.execute("delete from ir_act_report_xml where id=%d", (id,)) + cr.execute("delete from ir_values where value='ir.actions.report.xml,%d'", (id,)) cr.commit() diff --git a/doc/migrate/3.3.0-3.4.0/pre.py b/doc/migrate/3.3.0-3.4.0/pre.py index c2cab1b9e0a..df8e4a7d487 100644 --- a/doc/migrate/3.3.0-3.4.0/pre.py +++ b/doc/migrate/3.3.0-3.4.0/pre.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -79,18 +79,18 @@ cr = db.cursor() # ------------------------- # def change_column(cr, table, column, new_type, copy): - commands = [ - "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), - "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), - "ALTER TABLE %s DROP COLUMN temp_column" % table - ] - if copy: - commands.insert( - 2, - "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) - - for command in commands: - cr.execute(command) + commands = [ + "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), + "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), + "ALTER TABLE %s DROP COLUMN temp_column" % table + ] + if copy: + commands.insert( + 2, + "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) + + for command in commands: + cr.execute(command) change_column(cr, 'account_account_type', 'code_from', 'varchar(10)', False) change_column(cr, 'account_account_type', 'code_to', 'varchar(10)', False) @@ -101,17 +101,17 @@ cr.commit() # ----------------------------------------------------- # for line in ( - "alter table ir_model_fields add group_name varchar(64)", - "alter table ir_model_fields add view_load boolean", - "alter table ir_model_fields alter group_name set default ''", - "alter table ir_model_fields alter view_load set default False", - "delete from ir_values where value like '%,False'", - ): - try: - cr.execute(line) - except psycopg.ProgrammingError, e: - cr.commit() - print e + "alter table ir_model_fields add group_name varchar(64)", + "alter table ir_model_fields add view_load boolean", + "alter table ir_model_fields alter group_name set default ''", + "alter table ir_model_fields alter view_load set default False", + "delete from ir_values where value like '%,False'", + ): + try: + cr.execute(line) + except psycopg.ProgrammingError, e: + cr.commit() + print e cr.commit() cr.close() diff --git a/doc/migrate/3.4.0-4.0.0/post-tiny.py b/doc/migrate/3.4.0-4.0.0/post-tiny.py index ff47b041398..5c3646de8a0 100644 --- a/doc/migrate/3.4.0-4.0.0/post-tiny.py +++ b/doc/migrate/3.4.0-4.0.0/post-tiny.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- diff --git a/doc/migrate/3.4.0-4.0.0/post.py b/doc/migrate/3.4.0-4.0.0/post.py index 9afdd89c038..c90da55750a 100644 --- a/doc/migrate/3.4.0-4.0.0/post.py +++ b/doc/migrate/3.4.0-4.0.0/post.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -86,10 +86,10 @@ cr.commit() # --------------- # while True: - cr.execute("select id from ir_ui_menu where (id not in (select parent_id from ir_ui_menu where parent_id is not null)) and (id not in (select res_id from ir_values where model='ir.ui.menu'))") - if not cr.rowcount: - break - cr.execute("delete from ir_ui_menu where (id not in (select parent_id from ir_ui_menu where parent_id is not null)) and (id not in (select res_id from ir_values where model='ir.ui.menu'))") + cr.execute("select id from ir_ui_menu where (id not in (select parent_id from ir_ui_menu where parent_id is not null)) and (id not in (select res_id from ir_values where model='ir.ui.menu'))") + if not cr.rowcount: + break + cr.execute("delete from ir_ui_menu where (id not in (select parent_id from ir_ui_menu where parent_id is not null)) and (id not in (select res_id from ir_values where model='ir.ui.menu'))") cr.commit() # ----------------------------------------- # @@ -114,7 +114,7 @@ It is not possible to migrate the data automatically so you need to create the o And then update the field uos_id of the table account_invoice to match the new id of product_uom. EXAMPLE: - UPDATE account_invoice SET uos_id = new_id WHERE uos_id = old_id; + UPDATE account_invoice SET uos_id = new_id WHERE uos_id = old_id; """ cr.close() diff --git a/doc/migrate/3.4.0-4.0.0/pre-tiny.py b/doc/migrate/3.4.0-4.0.0/pre-tiny.py index fadcb2bc37e..c76e3520f5b 100644 --- a/doc/migrate/3.4.0-4.0.0/pre-tiny.py +++ b/doc/migrate/3.4.0-4.0.0/pre-tiny.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -79,18 +79,18 @@ cr = db.cursor() # ------------------------- # def change_column(cr, table, column, new_type, copy): - commands = [ - "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), - "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), - "ALTER TABLE %s DROP COLUMN temp_column" % table - ] - if copy: - commands.insert( - 2, - "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) - - for command in commands: - cr.execute(command) + commands = [ + "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), + "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), + "ALTER TABLE %s DROP COLUMN temp_column" % table + ] + if copy: + commands.insert( + 2, + "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) + + for command in commands: + cr.execute(command) #change_column(cr, 'crm_case', 'date_closed', 'timestamp', True) cr.commit() @@ -101,7 +101,7 @@ cr.commit() cr.execute("SELECT name FROM ir_module_module") if not cr.rowcount: - for module in set(['base', 'marketing', 'subscription', 'account', 'base_partner_relation', 'audittrail', 'account_followup', 'product', 'hr', 'l10n_simple', 'crm', 'stock', 'hr_timesheet', 'purchase', 'report_purchase', 'mrp', 'sale', 'report_sale', 'delivery', 'project', 'sale_crm', 'hr_timesheet_project', 'scrum', 'report_project', + for module in set(['base', 'marketing', 'subscription', 'account', 'base_partner_relation', 'audittrail', 'account_followup', 'product', 'hr', 'l10n_simple', 'crm', 'stock', 'hr_timesheet', 'purchase', 'report_purchase', 'mrp', 'sale', 'report_sale', 'delivery', 'project', 'sale_crm', 'hr_timesheet_project', 'scrum', 'report_project', 'account_followup', 'account', 'audittrail', @@ -131,8 +131,8 @@ if not cr.rowcount: 'sandwich', 'scrum', 'stock']): - cr.execute("INSERT INTO ir_module_module (name, state) VALUES ('%s', 'installed')" % module) - cr.commit() + cr.execute("INSERT INTO ir_module_module (name, state) VALUES ('%s', 'installed')" % module) + cr.commit() # ----------------------------------------------------- # @@ -140,11 +140,11 @@ if not cr.rowcount: # ----------------------------------------------------- # for line in ( - "ALTER TABLE ir_module_module ADD demo BOOLEAN DEFAULT False", - "delete from ir_values where value like '%,False'", - """UPDATE ir_ui_view set arch='<?xml version="1.0"?><tree string="Menu" toolbar="1"><field icon="icon" name="name"/></tree>' where name='ir.ui.menu.tree' and type='tree' and field_parent='child_id'""", - ): - cr.execute(line) + "ALTER TABLE ir_module_module ADD demo BOOLEAN DEFAULT False", + "delete from ir_values where value like '%,False'", + """UPDATE ir_ui_view set arch='<?xml version="1.0"?><tree string="Menu" toolbar="1"><field icon="icon" name="name"/></tree>' where name='ir.ui.menu.tree' and type='tree' and field_parent='child_id'""", + ): + cr.execute(line) cr.commit() cr.close() diff --git a/doc/migrate/3.4.0-4.0.0/pre.py b/doc/migrate/3.4.0-4.0.0/pre.py index 36cd4c17b97..ceb3683d1bc 100644 --- a/doc/migrate/3.4.0-4.0.0/pre.py +++ b/doc/migrate/3.4.0-4.0.0/pre.py @@ -53,15 +53,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -79,18 +79,18 @@ cr = db.cursor() # ------------------------- # def change_column(cr, table, column, new_type, copy): - commands = [ - "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), - "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), - "ALTER TABLE %s DROP COLUMN temp_column" % table - ] - if copy: - commands.insert( - 2, - "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) - - for command in commands: - cr.execute(command) + commands = [ + "ALTER TABLE %s RENAME COLUMN %s TO temp_column" % (table, column), + "ALTER TABLE %s ADD COLUMN %s %s" % (table, column, new_type), + "ALTER TABLE %s DROP COLUMN temp_column" % table + ] + if copy: + commands.insert( + 2, + "UPDATE %s SET %s=temp_column::%s" % (table, column, new_type)) + + for command in commands: + cr.execute(command) change_column(cr, 'crm_case', 'date_closed', 'timestamp', True) cr.commit() @@ -101,19 +101,19 @@ cr.commit() cr.execute("SELECT name FROM ir_module_module") if not cr.rowcount: - for module in ('base', 'marketing', 'subscription', 'account', 'base_partner_relation', 'audittrail', 'account_followup', 'product', 'hr', 'l10n_simple', 'crm', 'stock', 'hr_timesheet', 'purchase', 'report_purchase', 'mrp', 'sale', 'report_sale', 'delivery', 'project', 'sale_crm', 'hr_timesheet_project', 'scrum', 'report_project'): - cr.execute("INSERT INTO ir_module_module (name, state) VALUES ('%s', 'installed')" % module) - cr.commit() + for module in ('base', 'marketing', 'subscription', 'account', 'base_partner_relation', 'audittrail', 'account_followup', 'product', 'hr', 'l10n_simple', 'crm', 'stock', 'hr_timesheet', 'purchase', 'report_purchase', 'mrp', 'sale', 'report_sale', 'delivery', 'project', 'sale_crm', 'hr_timesheet_project', 'scrum', 'report_project'): + cr.execute("INSERT INTO ir_module_module (name, state) VALUES ('%s', 'installed')" % module) + cr.commit() # --------------- # # remove old menu # # --------------- # while True: - cr.execute("select id from ir_ui_menu where id not in (select parent_id from ir_ui_menu where parent_id is not null) and id not in (select res_id from ir_model_data where model='ir.ui.menu')") - if not cr.rowcount: - break - cr.execute("delete from ir_ui_menu where id not in (select parent_id from ir_ui_menu where parent_id is not null) and id not in (select res_id from ir_model_data where model='ir.ui.menu')") + cr.execute("select id from ir_ui_menu where id not in (select parent_id from ir_ui_menu where parent_id is not null) and id not in (select res_id from ir_model_data where model='ir.ui.menu')") + if not cr.rowcount: + break + cr.execute("delete from ir_ui_menu where id not in (select parent_id from ir_ui_menu where parent_id is not null) and id not in (select res_id from ir_model_data where model='ir.ui.menu')") cr.commit() # ----------------------------------------------------- # @@ -121,12 +121,12 @@ cr.commit() # ----------------------------------------------------- # for line in ( - "ALTER TABLE ir_module_module ADD demo BOOLEAN", - "ALTER TABLE ir_module_module SET demo DEFAULT False", - "DELETE FROM ir_values WHERE VALUE LIKE '%,False'", - """UPDATE ir_ui_view set arch='<?xml version="1.0"?><tree string="Menu" toolbar="1"><field icon="icon" name="name"/></tree>' where name='ir.ui.menu.tree' and type='tree' and field_parent='child_id'""", - ): - cr.execute(line) + "ALTER TABLE ir_module_module ADD demo BOOLEAN", + "ALTER TABLE ir_module_module SET demo DEFAULT False", + "DELETE FROM ir_values WHERE VALUE LIKE '%,False'", + """UPDATE ir_ui_view set arch='<?xml version="1.0"?><tree string="Menu" toolbar="1"><field icon="icon" name="name"/></tree>' where name='ir.ui.menu.tree' and type='tree' and field_parent='child_id'""", + ): + cr.execute(line) cr.commit() cr.close() diff --git a/doc/migrate/4.0.0-4.2.0/pre.py b/doc/migrate/4.0.0-4.2.0/pre.py index cfa9b011aa9..e3f6d4905c3 100644 --- a/doc/migrate/4.0.0-4.2.0/pre.py +++ b/doc/migrate/4.0.0-4.2.0/pre.py @@ -54,15 +54,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -82,13 +82,13 @@ cr = db.cursor() cr.execute("""SELECT c.relname,a.attname,a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,t.typname,CASE WHEN a.attlen=-1 THEN a.atttypmod-4 ELSE a.attlen END as size FROM pg_class c,pg_attribute a,pg_type t WHERE c.relname='res_currency' AND a.attname='rounding' AND c.oid=a.attrelid AND a.atttypid=t.oid""") res = cr.dictfetchall() if res[0]['typname'] != 'numeric': - for line in ( - "ALTER TABLE res_currency RENAME rounding TO rounding_bak", - "ALTER TABLE res_currency ADD rounding NUMERIC(12,6)", - "UPDATE res_currency SET rounding = power(10, - rounding_bak)", - "ALTER TABLE res_currency DROP rounding_bak", - ): - cr.execute(line) + for line in ( + "ALTER TABLE res_currency RENAME rounding TO rounding_bak", + "ALTER TABLE res_currency ADD rounding NUMERIC(12,6)", + "UPDATE res_currency SET rounding = power(10, - rounding_bak)", + "ALTER TABLE res_currency DROP rounding_bak", + ): + cr.execute(line) cr.commit() # ----------------------------- # @@ -97,7 +97,7 @@ cr.commit() cr.execute('SELECT conname FROM pg_constraint where conname = \'ir_ui_view_type\'') if cr.fetchall(): - cr.execute('ALTER TABLE ir_ui_view DROP CONSTRAINT ir_ui_view_type') + cr.execute('ALTER TABLE ir_ui_view DROP CONSTRAINT ir_ui_view_type') cr.commit() # ------------------------ # @@ -106,7 +106,7 @@ cr.commit() cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname = \'res_partner_bank\' AND a.attname = \'iban\' AND c.oid = a.attrelid') if cr.fetchall(): - cr.execute('ALTER TABLE res_partner_bank RENAME iban TO acc_number') + cr.execute('ALTER TABLE res_partner_bank RENAME iban TO acc_number') cr.commit() # ------------------------------------------- # @@ -115,12 +115,12 @@ cr.commit() cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname = \'ir_model\' AND a.attname = \'perm_id\' AND c.oid = a.attrelid') if not cr.fetchall(): - cr.execute("ALTER TABLE ir_model ADD perm_id int references perm on delete set null") + cr.execute("ALTER TABLE ir_model ADD perm_id int references perm on delete set null") cr.commit() cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname = \'ir_model_fields\' AND a.attname = \'perm_id\' AND c.oid = a.attrelid') if not cr.fetchall(): - cr.execute("ALTER TABLE ir_model_fields ADD perm_id int references perm on delete set null") + cr.execute("ALTER TABLE ir_model_fields ADD perm_id int references perm on delete set null") cr.commit() @@ -138,9 +138,9 @@ cr.commit() cr.execute('SELECT model_id FROM ir_model_access') res= cr.fetchall() for r in res: - cr.execute('SELECT id FROM ir_model_access WHERE model_id = %d AND group_id IS NULL', (r[0],)) - if not cr.fetchall(): - cr.execute("INSERT into ir_model_access (name,model_id,group_id) VALUES ('Auto-generated access by migration',%d,NULL)",(r[0],)) + cr.execute('SELECT id FROM ir_model_access WHERE model_id = %d AND group_id IS NULL', (r[0],)) + if not cr.fetchall(): + cr.execute("INSERT into ir_model_access (name,model_id,group_id) VALUES ('Auto-generated access by migration',%d,NULL)",(r[0],)) cr.commit() # ------------------------------------------------- # @@ -149,7 +149,7 @@ cr.commit() cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_line_to_invoice\'') if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_line_to_invoice') + cr.execute('DROP VIEW report_account_analytic_line_to_invoice') cr.commit() # --------------------------- # @@ -158,7 +158,7 @@ cr.commit() cr.execute('SELECT * FROM pg_class c, pg_attribute a WHERE c.relname=\'hr_employee\' AND a.attname=\'state\' AND c.oid=a.attrelid') if cr.fetchall(): - cr.execute('ALTER TABLE hr_employee DROP state') + cr.execute('ALTER TABLE hr_employee DROP state') cr.commit() # ------------ # @@ -167,10 +167,10 @@ cr.commit() cr.execute('SELECT id FROM ir_values where model=\'res.users\' AND key=\'meta\' AND name=\'tz\'') if not cr.fetchall(): - import pytz, pickle - meta = pickle.dumps({'type':'selection', 'string':'Timezone', 'selection': [(x, x) for x in pytz.all_timezones]}) - value = pickle.dumps(False) - cr.execute('INSERT INTO ir_values (name, key, model, meta, key2, object, value) VALUES (\'tz\', \'meta\', \'res.users\', %s, \'tz\', %s, %s)', (meta,False, value)) + import pytz, pickle + meta = pickle.dumps({'type':'selection', 'string':'Timezone', 'selection': [(x, x) for x in pytz.all_timezones]}) + value = pickle.dumps(False) + cr.execute('INSERT INTO ir_values (name, key, model, meta, key2, object, value) VALUES (\'tz\', \'meta\', \'res.users\', %s, \'tz\', %s, %s)', (meta,False, value)) cr.commit() # ------------------------- # @@ -179,36 +179,36 @@ cr.commit() cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = \'product_uom\' AND a.attname = \'factor\' AND c.oid = a.attrelid AND a.atttypid = t.oid AND t.typname = \'float8\'') if cr.fetchall(): - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat_account\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_planning_stat_account') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_planning_stat') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat_user\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_planning_stat_user') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_product\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_purchase_order_product') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_category\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_purchase_order_category') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_product\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_sale_order_product') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_category\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_sale_order_category') - cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_hr_timesheet_invoice_journal\'') - if cr.fetchall(): - cr.execute('DROP VIEW report_hr_timesheet_invoice_journal') - - cr.execute('ALTER TABLE product_uom RENAME COLUMN factor to temp_column') - cr.execute('ALTER TABLE product_uom ADD COLUMN factor NUMERIC(12,6)') - cr.execute('UPDATE product_uom SET factor = temp_column') - cr.execute('ALTER TABLE product_uom ALTER factor SET NOT NULL') - cr.execute('ALTER TABLE product_uom DROP COLUMN temp_column') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat_account\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_account_analytic_planning_stat_account') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_account_analytic_planning_stat') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat_user\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_account_analytic_planning_stat_user') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_product\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_purchase_order_product') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_category\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_purchase_order_category') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_product\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_sale_order_product') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_category\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_sale_order_category') + cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_hr_timesheet_invoice_journal\'') + if cr.fetchall(): + cr.execute('DROP VIEW report_hr_timesheet_invoice_journal') + + cr.execute('ALTER TABLE product_uom RENAME COLUMN factor to temp_column') + cr.execute('ALTER TABLE product_uom ADD COLUMN factor NUMERIC(12,6)') + cr.execute('UPDATE product_uom SET factor = temp_column') + cr.execute('ALTER TABLE product_uom ALTER factor SET NOT NULL') + cr.execute('ALTER TABLE product_uom DROP COLUMN temp_column') cr.commit() @@ -218,7 +218,7 @@ cr.commit() cr.execute('SELECT conname FROM pg_constraint where conname = \'stock_production_lot_name_uniq\'') if cr.fetchall(): - cr.execute('ALTER TABLE stock_production_lot DROP CONSTRAINT stock_production_lot_name_uniq') + cr.execute('ALTER TABLE stock_production_lot DROP CONSTRAINT stock_production_lot_name_uniq') cr.commit() # ------------------------------------ # @@ -235,19 +235,19 @@ cr.commit() cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_report_xml_pkey\' and tablename = \'ir_act_report_xml\'') if not cr.fetchall(): - cr.execute('ALTER TABLE ir_act_report_xml ADD PRIMARY KEY (id)') + cr.execute('ALTER TABLE ir_act_report_xml ADD PRIMARY KEY (id)') cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_report_custom_pkey\' and tablename = \'ir_act_report_custom\'') if not cr.fetchall(): - cr.execute('ALTER TABLE ir_act_report_custom ADD PRIMARY KEY (id)') + cr.execute('ALTER TABLE ir_act_report_custom ADD PRIMARY KEY (id)') cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_group_pkey\' and tablename = \'ir_act_group\'') if not cr.fetchall(): - cr.execute('ALTER TABLE ir_act_group ADD PRIMARY KEY (id)') + cr.execute('ALTER TABLE ir_act_group ADD PRIMARY KEY (id)') cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_execute_pkey\' and tablename = \'ir_act_execute\'') if not cr.fetchall(): - cr.execute('ALTER TABLE ir_act_execute ADD PRIMARY KEY (id)') + cr.execute('ALTER TABLE ir_act_execute ADD PRIMARY KEY (id)') cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_wizard_pkey\' and tablename = \'ir_act_wizard\'') if not cr.fetchall(): - cr.execute('ALTER TABLE ir_act_wizard ADD PRIMARY KEY (id)') + cr.execute('ALTER TABLE ir_act_wizard ADD PRIMARY KEY (id)') cr.commit() cr.close diff --git a/doc/migrate/4.0.0-4.2.0/tiny/pre-tiny.py b/doc/migrate/4.0.0-4.2.0/tiny/pre-tiny.py index c341461ab81..b63fff6dda6 100644 --- a/doc/migrate/4.0.0-4.2.0/tiny/pre-tiny.py +++ b/doc/migrate/4.0.0-4.2.0/tiny/pre-tiny.py @@ -54,15 +54,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) raise Exception('This script is provided as an example, you must custom it before') @@ -84,18 +84,18 @@ cr.execute('SELECT code from res_country where code is not null group by code') res = cr.fetchall() for c in res: - cr.execute('SELECT max(id) from res_country where code = %s group by code', (c[0],)) - res2 = cr.fetchone() - cr.execute('SELECT id from res_country where code = %s', (c[0],)) - ids = ','.join(map(lambda x: str(x[0]), cr.fetchall())) - cr.execute('UPDATE res_partner_address set country_id = %d where country_id in ('+ids+')', (res2[0],)) - cr.execute('DELETE FROM res_country WHERE code = %s and id <> %d', (c[0], res2[0],)) + cr.execute('SELECT max(id) from res_country where code = %s group by code', (c[0],)) + res2 = cr.fetchone() + cr.execute('SELECT id from res_country where code = %s', (c[0],)) + ids = ','.join(map(lambda x: str(x[0]), cr.fetchall())) + cr.execute('UPDATE res_partner_address set country_id = %d where country_id in ('+ids+')', (res2[0],)) + cr.execute('DELETE FROM res_country WHERE code = %s and id <> %d', (c[0], res2[0],)) cr.commit() cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_planning_stat\'') if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_planning_stat') + cr.execute('DROP VIEW report_account_analytic_planning_stat') cr.commit() @@ -104,59 +104,59 @@ res = cr.fetchall() for p in res: - cr.execute('SELECT max(id) FROM res_partner WHERE name = %s GROUP BY name', (p[0],)) - res2 = cr.fetchone() - cr.execute('UPDATE res_partner set active = False WHERE name = %s and id <> %d', (p[0], res2[0],)) - cr.execute('SELECT id FROM res_partner WHERE name = %s AND id <> %d', (p[0], res2[0],)) - res3 = cr.fetchall() - i = 0 - for id in res3: - name = p[0]+' old' - if i: - name = name + ' ' + str(i) - cr.execute('UPDATE res_partner set name = %s WHERE id = %d', (name, id[0])) - i += 1 + cr.execute('SELECT max(id) FROM res_partner WHERE name = %s GROUP BY name', (p[0],)) + res2 = cr.fetchone() + cr.execute('UPDATE res_partner set active = False WHERE name = %s and id <> %d', (p[0], res2[0],)) + cr.execute('SELECT id FROM res_partner WHERE name = %s AND id <> %d', (p[0], res2[0],)) + res3 = cr.fetchall() + i = 0 + for id in res3: + name = p[0]+' old' + if i: + name = name + ' ' + str(i) + cr.execute('UPDATE res_partner set name = %s WHERE id = %d', (name, id[0])) + i += 1 cr.commit() cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_account_analytic_line_to_invoice\'') if cr.fetchall(): - cr.execute('DROP VIEW report_account_analytic_line_to_invoice') + cr.execute('DROP VIEW report_account_analytic_line_to_invoice') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_timesheet_invoice\'') if cr.fetchall(): - cr.execute('drop VIEW report_timesheet_invoice') + cr.execute('drop VIEW report_timesheet_invoice') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_category\'') if cr.fetchall(): - cr.execute('drop VIEW report_purchase_order_category') + cr.execute('drop VIEW report_purchase_order_category') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_purchase_order_product\'') if cr.fetchall(): - cr.execute('drop VIEW report_purchase_order_product') + cr.execute('drop VIEW report_purchase_order_product') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_category\'') if cr.fetchall(): - cr.execute('drop VIEW report_sale_order_category') + cr.execute('drop VIEW report_sale_order_category') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_sale_order_product\'') if cr.fetchall(): - cr.execute('drop VIEW report_sale_order_product') + cr.execute('drop VIEW report_sale_order_product') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_timesheet_user\'') if cr.fetchall(): - cr.execute('drop VIEW report_timesheet_user') + cr.execute('drop VIEW report_timesheet_user') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'report_task_user_pipeline_open\'') if cr.fetchall(): - cr.execute('drop VIEW report_task_user_pipeline_open') + cr.execute('drop VIEW report_task_user_pipeline_open') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'hr_timesheet_sheet_sheet_day\'') if cr.fetchall(): - cr.execute('drop VIEW hr_timesheet_sheet_sheet_day') + cr.execute('drop VIEW hr_timesheet_sheet_sheet_day') cr.execute('SELECT viewname FROM pg_views WHERE viewname = \'hr_timesheet_sheet_sheet_account\'') if cr.fetchall(): - cr.execute('drop VIEW hr_timesheet_sheet_sheet_account') + cr.execute('drop VIEW hr_timesheet_sheet_sheet_account') cr.execute('SELECT viewname from pg_views where viewname = \'sale_journal_sale_stats\'') if cr.fetchall(): - cr.execute('drop VIEW sale_journal_sale_stats') + cr.execute('drop VIEW sale_journal_sale_stats') cr.execute('SELECT viewname from pg_views where viewname = \'sale_journal_picking_stats\'') if cr.fetchall(): - cr.execute('drop VIEW sale_journal_picking_stats') + cr.execute('drop VIEW sale_journal_picking_stats') cr.execute('SELECT viewname from pg_views where viewname = \'sale_journal_invoice_type_stats\'') if cr.fetchall(): - cr.execute('drop VIEW sale_journal_invoice_type_stats') + cr.execute('drop VIEW sale_journal_invoice_type_stats') cr.execute('ALTER TABLE product_template ALTER list_price TYPE numeric(16,2)') cr.execute('ALTER TABLE product_template ALTER standard_price TYPE numeric(16,2)') @@ -171,13 +171,13 @@ cr.commit() cr.execute('SELECT tablename FROM pg_tables WHERE tablename = \'subscription_document_fields\'') if cr.fetchall(): - cr.execute('DROP TABLE subscription_document_fields') + cr.execute('DROP TABLE subscription_document_fields') cr.execute('SELECT tablename FROM pg_tables WHERE tablename = \'subscription_document\'') if cr.fetchall(): - cr.execute('DROP TABLE subscription_document') + cr.execute('DROP TABLE subscription_document') cr.execute('SELECT tablename FROM pg_tables WHERE tablename = \'subscription_subscription_history\'') if cr.fetchall(): - cr.execute('DROP TABLE subscription_subscription_history') + cr.execute('DROP TABLE subscription_subscription_history') cr.commit() # -------------------- # @@ -186,9 +186,9 @@ cr.commit() cr.execute('SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname = \'res_currency_rate\' AND a.attname = \'rate_old\' AND c.oid = a.attrelid') if not cr.fetchall(): - cr.execute('ALTER TABLE res_currency_rate ADD rate_old NUMERIC(12,6)') - cr.execute('UPDATE res_currency_rate SET rate_old = rate') - cr.execute('UPDATE res_currency_rate SET rate = (1 / rate_old)') + cr.execute('ALTER TABLE res_currency_rate ADD rate_old NUMERIC(12,6)') + cr.execute('UPDATE res_currency_rate SET rate_old = rate') + cr.execute('UPDATE res_currency_rate SET rate = (1 / rate_old)') cr.commit() cr.close diff --git a/doc/migrate/4.2.0-4.4.0/pre.py b/doc/migrate/4.2.0-4.4.0/pre.py index ac8ed0a6017..8d0ad4243a0 100644 --- a/doc/migrate/4.2.0-4.4.0/pre.py +++ b/doc/migrate/4.2.0-4.4.0/pre.py @@ -54,15 +54,15 @@ options.db_name = 'terp' # default value parser.parse_args(values=options) if hasattr(options, 'config'): - configparser = ConfigParser.ConfigParser() - configparser.read([options.config]) - for name, value in configparser.items('options'): - if not (hasattr(options, name) and getattr(options, name)): - if value in ('true', 'True'): - value = True - if value in ('false', 'False'): - value = False - setattr(options, name, value) + configparser = ConfigParser.ConfigParser() + configparser.read([options.config]) + for name, value in configparser.items('options'): + if not (hasattr(options, name) and getattr(options, name)): + if value in ('true', 'True'): + value = True + if value in ('false', 'False'): + value = False + setattr(options, name, value) # ----- @@ -80,8 +80,8 @@ cr = db.cursor() # ------------------------------ # cr.execute('ALTER TABLE ir_attachment \ - ALTER COLUMN res_model DROP NOT NULL, \ - ALTER COLUMN res_id DROP NOT NULL') + ALTER COLUMN res_model DROP NOT NULL, \ + ALTER COLUMN res_id DROP NOT NULL') cr.commit() # ---------------------------------- # @@ -96,13 +96,13 @@ a.attname='date_deadline' AND c.oid=a.attrelid AND a.atttypid=t.oid""") res = cr.dictfetchall() if res[0]['typname'] != 'timestamp': - for line in ( - "ALTER TABLE crm_case RENAME date_deadline TO date_deadline_bak", - "ALTER TABLE crm_case ADD date_deadline timestamp", - "UPDATE crm_case SET date_deadline = date_deadline_bak", - "ALTER TABLE crm_case DROP date_deadline_bak", - ): - cr.execute(line) + for line in ( + "ALTER TABLE crm_case RENAME date_deadline TO date_deadline_bak", + "ALTER TABLE crm_case ADD date_deadline timestamp", + "UPDATE crm_case SET date_deadline = date_deadline_bak", + "ALTER TABLE crm_case DROP date_deadline_bak", + ): + cr.execute(line) cr.commit() cr.execute('drop view report_task_user_pipeline_open'); diff --git a/doc/tests/check_profile_l10n_all.py b/doc/tests/check_profile_l10n_all.py index 4404913fc80..d53d911adb8 100755..100644 --- a/doc/tests/check_profile_l10n_all.py +++ b/doc/tests/check_profile_l10n_all.py @@ -40,15 +40,15 @@ import base64 url = 'http://localhost:8069/xmlrpc' profiles = [ - 'profile_accounting', - 'profile_service', - 'profile_manufacturing' + 'profile_accounting', + 'profile_service', + 'profile_manufacturing' ] l10n_charts = [ - 'l10n_chart_uk_minimal', - False, - 'l10n_be', - 'l10n_fr' + 'l10n_chart_uk_minimal', + False, + 'l10n_be', + 'l10n_fr' ] dbname = 'test' admin_passwd = 'admin' @@ -64,62 +64,62 @@ demos = [True] langs = lang or (map(lambda x: x[0], sock2.list_lang()) + ['en_US']) def wait(id): - progress=0.0 - while not progress==1.0: - time.sleep(3) - progress,users = sock2.get_progress(admin_passwd, id) - time.sleep(3) - return True + progress=0.0 + while not progress==1.0: + time.sleep(3) + progress,users = sock2.get_progress(admin_passwd, id) + time.sleep(3) + return True def wizard_run(wizname, fieldvalues={}, endstate='end'): - wiz_id = sock4.create(dbname, uid, 'admin', wizname) - state = 'init' - datas = {'form':{}} - while state!=endstate: - res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {}) - if 'datas' in res: - datas['form'].update( res['datas'] ) - if res['type']=='form': - for field in res['fields'].keys(): - datas['form'][field] = res['fields'][field].get('value', False) - state = res['state'][-1][0] - datas['form'].update(fieldvalues) - elif res['type']=='state': - state = res['state'] - return True + wiz_id = sock4.create(dbname, uid, 'admin', wizname) + state = 'init' + datas = {'form':{}} + while state!=endstate: + res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {}) + if 'datas' in res: + datas['form'].update( res['datas'] ) + if res['type']=='form': + for field in res['fields'].keys(): + datas['form'][field] = res['fields'][field].get('value', False) + state = res['state'][-1][0] + datas['form'].update(fieldvalues) + elif res['type']=='state': + state = res['state'] + return True for demo in demos: - for l10n in l10n_charts: - print 'Testing localisation', l10n, '...' - for prof in profiles: - print '\tTesting profile', prof, '...' - id = sock2.create(admin_passwd, dbname, demo, lang) - wait(id) - uid = sock3.login(dbname, 'admin','admin') + for l10n in l10n_charts: + print 'Testing localisation', l10n, '...' + for prof in profiles: + print '\tTesting profile', prof, '...' + id = sock2.create(admin_passwd, dbname, demo, lang) + wait(id) + uid = sock3.login(dbname, 'admin','admin') - idprof = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',prof)]) - if l10n: - idl10n = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',l10n)]) - else: - idl10n = [-1] - wizard_run('base_setup.base_setup', { - 'profile': idprof[0], - 'charts': idl10n[0], - }, 'menu') - for lang in langs: - print '\t\tTesting Language', lang, '...' - wizard_run('module.lang.install', {'lang': lang}) + idprof = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',prof)]) + if l10n: + idl10n = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',l10n)]) + else: + idl10n = [-1] + wizard_run('base_setup.base_setup', { + 'profile': idprof[0], + 'charts': idl10n[0], + }, 'menu') + for lang in langs: + print '\t\tTesting Language', lang, '...' + wizard_run('module.lang.install', {'lang': lang}) - ok = False - range = 4 - while (not ok) and range: - try: - time.sleep(2) - id = sock2.drop(admin_passwd, dbname) - ok = True - except: - range -= 1 - time.sleep(2) + ok = False + range = 4 + while (not ok) and range: + try: + time.sleep(2) + id = sock2.drop(admin_passwd, dbname) + ok = True + except: + range -= 1 + time.sleep(2) |
