From 6ef83da9acf2b0edd070e4ea84adb24e3510514d Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Fri, 20 Dec 2013 13:51:24 -0500 Subject: [PATCH] [FIX] PEP8 and file permission issues --- base_external_dbsource/__init__.py | 0 .../base_external_dbsource.py | 39 ++++++++----------- .../base_external_dbsource_demo.xml | 0 .../security/ir.model.access.csv | 0 .../test/dbsource_connect.yml | 0 import_odbc/__init__.py | 0 import_odbc/import_odbc.py | 4 +- import_odbc/import_odbc_demo.xml | 0 8 files changed, 20 insertions(+), 23 deletions(-) mode change 100755 => 100644 base_external_dbsource/__init__.py mode change 100755 => 100644 base_external_dbsource/base_external_dbsource_demo.xml mode change 100755 => 100644 base_external_dbsource/security/ir.model.access.csv mode change 100755 => 100644 base_external_dbsource/test/dbsource_connect.yml mode change 100755 => 100644 import_odbc/__init__.py mode change 100755 => 100644 import_odbc/import_odbc_demo.xml diff --git a/base_external_dbsource/__init__.py b/base_external_dbsource/__init__.py old mode 100755 new mode 100644 diff --git a/base_external_dbsource/base_external_dbsource.py b/base_external_dbsource/base_external_dbsource.py index 05e9a7b2d..e9e4e787f 100644 --- a/base_external_dbsource/base_external_dbsource.py +++ b/base_external_dbsource/base_external_dbsource.py @@ -30,20 +30,22 @@ CONNECTORS = [] try: import sqlalchemy - import pymssql - CONNECTORS.append(('mssql', 'Microsoft SQL Server')) + CONNECTORS.append(('sqlite', 'SQLite')) + try: + import pymssql + CONNECTORS.append(('mssql', 'Microsoft SQL Server')) + except: + _logger.info('MS SQL Server not available. Please install "pymssql"\ + python package.') + try: + import MySQLdb + CONNECTORS.append(('mysql', 'MySQL')) + except: + _logger.info('MySQL not available. Please install "mysqldb"\ + python package.') except: - _logger.info('MS SQL Server not available. Please install "slqalchemy"\ - and "pymssql" python package.') - -try: - import sqlalchemy - import MySQLdb - CONNECTORS.append(('mysql', 'MySQL')) -except: - _logger.info('MySQL not available. Please install "slqalchemy" and\ - "mysqldb" python package.') - + _logger.info('SQL Alchemy not available. Please install "slqalchemy"\ + python package.') try: import pyodbc CONNECTORS.append(('pyodbc', 'ODBC')) @@ -61,13 +63,6 @@ except: import psycopg2 CONNECTORS.append(('postgresql', 'PostgreSQL')) -try: - import sqlalchemy - CONNECTORS.append(('sqlite', 'SQLite')) -except: - _logger.info('SQLAlchemy not available. Please install "slqalchemy" python\ - package.') - class base_external_dbsource(orm.Model): _name = "base.external.dbsource" @@ -163,7 +158,7 @@ Sample connection strings: try: conn = self.conn_open(cr, uid, obj.id) except Exception, e: - raise osv.except_osv(_("Connection test failed!"), + raise orm.except_orm(_("Connection test failed!"), _("Here is what we got instead:\n %s") % tools.ustr(e)) finally: @@ -174,7 +169,7 @@ Sample connection strings: # ignored, just a consequence of the previous exception pass #TODO: if OK a (wizard) message box should be displayed - raise osv.except_osv(_("Connection test succeeded!"), + raise orm.except_orm(_("Connection test succeeded!"), _("Everything seems properly set up!")) #EOF diff --git a/base_external_dbsource/base_external_dbsource_demo.xml b/base_external_dbsource/base_external_dbsource_demo.xml old mode 100755 new mode 100644 diff --git a/base_external_dbsource/security/ir.model.access.csv b/base_external_dbsource/security/ir.model.access.csv old mode 100755 new mode 100644 diff --git a/base_external_dbsource/test/dbsource_connect.yml b/base_external_dbsource/test/dbsource_connect.yml old mode 100755 new mode 100644 diff --git a/import_odbc/__init__.py b/import_odbc/__init__.py old mode 100755 new mode 100644 diff --git a/import_odbc/import_odbc.py b/import_odbc/import_odbc.py index c6995a296..9a16346be 100644 --- a/import_odbc/import_odbc.py +++ b/import_odbc/import_odbc.py @@ -40,7 +40,9 @@ class import_odbc_dbtable(orm.Model): 'model_target': fields.many2one('ir.model', 'Target object'), 'noupdate': fields.boolean('No updates', help="Only create new records; disable updates to existing records."), 'exec_order': fields.integer('Execution order', help="Defines the order to perform the import"), - 'last_sync': fields.datetime('Last sync date', help="Datetime for the last succesfull sync. Later changes on the source may not be replicated on the destination"), + 'last_sync': fields.datetime('Last sync date', + help="Datetime for the last succesfull sync." + "\nLater changes on the source may not be replicated on the destination"), 'start_run': fields.datetime('Time started', readonly=True), 'last_run': fields.datetime('Time ended', readonly=True), 'last_record_count': fields.integer('Last record count', readonly=True), diff --git a/import_odbc/import_odbc_demo.xml b/import_odbc/import_odbc_demo.xml old mode 100755 new mode 100644