[FIX] PEP8 and file permission issues

pull/4/head
Maxime Chambreuil 2013-12-20 13:51:24 -05:00
parent 0042904f45
commit 6ef83da9ac
8 changed files with 20 additions and 23 deletions

View File

View File

@ -30,20 +30,22 @@ CONNECTORS = []
try: try:
import sqlalchemy import sqlalchemy
import pymssql CONNECTORS.append(('sqlite', 'SQLite'))
CONNECTORS.append(('mssql', 'Microsoft SQL Server')) 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: except:
_logger.info('MS SQL Server not available. Please install "slqalchemy"\ _logger.info('SQL Alchemy not available. Please install "slqalchemy"\
and "pymssql" python package.') python package.')
try:
import sqlalchemy
import MySQLdb
CONNECTORS.append(('mysql', 'MySQL'))
except:
_logger.info('MySQL not available. Please install "slqalchemy" and\
"mysqldb" python package.')
try: try:
import pyodbc import pyodbc
CONNECTORS.append(('pyodbc', 'ODBC')) CONNECTORS.append(('pyodbc', 'ODBC'))
@ -61,13 +63,6 @@ except:
import psycopg2 import psycopg2
CONNECTORS.append(('postgresql', 'PostgreSQL')) 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): class base_external_dbsource(orm.Model):
_name = "base.external.dbsource" _name = "base.external.dbsource"
@ -163,7 +158,7 @@ Sample connection strings:
try: try:
conn = self.conn_open(cr, uid, obj.id) conn = self.conn_open(cr, uid, obj.id)
except Exception, e: 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") _("Here is what we got instead:\n %s")
% tools.ustr(e)) % tools.ustr(e))
finally: finally:
@ -174,7 +169,7 @@ Sample connection strings:
# ignored, just a consequence of the previous exception # ignored, just a consequence of the previous exception
pass pass
#TODO: if OK a (wizard) message box should be displayed #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!")) _("Everything seems properly set up!"))
#EOF #EOF

View File

0
import_odbc/__init__.py 100755 → 100644
View File

View File

@ -40,7 +40,9 @@ class import_odbc_dbtable(orm.Model):
'model_target': fields.many2one('ir.model', 'Target object'), 'model_target': fields.many2one('ir.model', 'Target object'),
'noupdate': fields.boolean('No updates', help="Only create new records; disable updates to existing records."), '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"), '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), 'start_run': fields.datetime('Time started', readonly=True),
'last_run': fields.datetime('Time ended', readonly=True), 'last_run': fields.datetime('Time ended', readonly=True),
'last_record_count': fields.integer('Last record count', readonly=True), 'last_record_count': fields.integer('Last record count', readonly=True),

0
import_odbc/import_odbc_demo.xml 100755 → 100644
View File