From 49975648a8a7119450a28534836df282f0d5a98e Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Thu, 17 Jul 2014 08:41:59 -0400 Subject: [PATCH] [PEP8] Misc --- auth_admin_passkey/model/res_users.py | 2 +- auth_from_http_basic/__init__.py | 3 ++- .../base_external_dbsource.py | 20 +++++++++---------- configuration_helper/config.py | 2 +- dbfilter_from_header/__openerp__.py | 18 ++++++++--------- server_environment_files/__init__.py | 2 +- web_context_tunnel/__openerp__.py | 4 ++-- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/auth_admin_passkey/model/res_users.py b/auth_admin_passkey/model/res_users.py index 6d050108c..d0a5a8aa2 100644 --- a/auth_admin_passkey/model/res_users.py +++ b/auth_admin_passkey/model/res_users.py @@ -35,7 +35,7 @@ class res_users(Model): # Private Function section def _get_translation(self, cr, lang, text): - context = {'lang': lang} + context = {'lang': lang} # noqa: _() checks page for locals return _(text) def _send_email_passkey(self, cr, user_id, user_agent_env): diff --git a/auth_from_http_basic/__init__.py b/auth_from_http_basic/__init__.py index 34a0d9550..4458cc282 100644 --- a/auth_from_http_basic/__init__.py +++ b/auth_from_http_basic/__init__.py @@ -36,7 +36,8 @@ def init(self, params): base_location=self.httprequest.url_root.rstrip('/'), HTTP_HOST=self.httprequest.environ['HTTP_HOST'], REMOTE_ADDR=self.httprequest.environ['REMOTE_ADDR'] - )) + ) + ) WebRequest.init = init diff --git a/base_external_dbsource/base_external_dbsource.py b/base_external_dbsource/base_external_dbsource.py index e9e4e787f..7353a1d9c 100644 --- a/base_external_dbsource/base_external_dbsource.py +++ b/base_external_dbsource/base_external_dbsource.py @@ -34,13 +34,15 @@ try: try: import pymssql CONNECTORS.append(('mssql', 'Microsoft SQL Server')) - except: + assert pymssql + except ImportError, AssertionError: _logger.info('MS SQL Server not available. Please install "pymssql"\ python package.') try: import MySQLdb CONNECTORS.append(('mysql', 'MySQL')) - except: + assert MySQLdb + except ImportError, AssertionError: _logger.info('MySQL not available. Please install "mysqldb"\ python package.') except: @@ -90,15 +92,15 @@ Sample connection strings: } def conn_open(self, cr, uid, id1): - #Get dbsource record + # Get dbsource record data = self.browse(cr, uid, id1) - #Build the full connection string + # Build the full connection string connStr = data.conn_string if data.password: if '%s' not in data.conn_string: connStr += ';PWD=%s' connStr = connStr % data.password - #Try to connect + # Try to connect if data.connector == 'cx_Oracle': os.environ['NLS_LANG'] = 'AMERICAN_AMERICA.UTF8' conn = cx_Oracle.connect(connStr) @@ -134,13 +136,13 @@ Sample connection strings: for obj in data: conn = self.conn_open(cr, uid, obj.id) if obj.connector in ["sqlite", "mysql", "mssql"]: - #using sqlalchemy + # using sqlalchemy cur = conn.execute(sqlquery, sqlparams) if metadata: cols = cur.keys() rows = [r for r in cur] else: - #using other db connectors + # using other db connectors cur = conn.cursor() cur.execute(sqlquery, sqlparams) if metadata: @@ -168,8 +170,6 @@ Sample connection strings: except Exception: # ignored, just a consequence of the previous exception pass - #TODO: if OK a (wizard) message box should be displayed + # TODO: if OK a (wizard) message box should be displayed raise orm.except_orm(_("Connection test succeeded!"), _("Everything seems properly set up!")) - -#EOF diff --git a/configuration_helper/config.py b/configuration_helper/config.py index 187d683ab..73fd58e2f 100644 --- a/configuration_helper/config.py +++ b/configuration_helper/config.py @@ -40,7 +40,7 @@ class AbstractConfigSettings(orm.AbstractModel): super(AbstractConfigSettings, self).__init__(pool, cr) if self._companyObject: for field_key in self._companyObject._columns: - #allows to exclude some field + # allows to exclude some field if self._filter_field(field_key): args = ('company_id', field_key) kwargs = { diff --git a/dbfilter_from_header/__openerp__.py b/dbfilter_from_header/__openerp__.py index 7baf1f9e7..4570e55d5 100644 --- a/dbfilter_from_header/__openerp__.py +++ b/dbfilter_from_header/__openerp__.py @@ -19,14 +19,14 @@ # ############################################################################## { - "name" : "dbfilter_from_header", - "version" : "1.0", - "author" : "Therp BV", + "name": "dbfilter_from_header", + "version": "1.0", + "author": "Therp BV", "complexity": "normal", "description": """ This addon lets you pass a dbfilter as a HTTP header. - This is interesting for setups where database names can't be mapped to + This is interesting for setups where database names can't be mapped to proxied host names. In nginx, use @@ -34,11 +34,11 @@ The addon has to be loaded as server-wide module. """, - "category" : "Tools", - "depends" : [ + "category": "Tools", + "depends": [ 'web', ], - "data" : [ + "data": [ ], "js": [ ], @@ -46,7 +46,7 @@ ], "auto_install": False, "installable": True, - "external_dependencies" : { - 'python' : [], + "external_dependencies": { + 'python': [], }, } diff --git a/server_environment_files/__init__.py b/server_environment_files/__init__.py index 31fea2953..98a6c9725 100644 --- a/server_environment_files/__init__.py +++ b/server_environment_files/__init__.py @@ -17,4 +17,4 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -############################################################################## \ No newline at end of file +############################################################################## diff --git a/web_context_tunnel/__openerp__.py b/web_context_tunnel/__openerp__.py index 3813782b6..ae463552e 100644 --- a/web_context_tunnel/__openerp__.py +++ b/web_context_tunnel/__openerp__.py @@ -3,7 +3,7 @@ 'category': 'Hidden', 'author': 'Akretion', 'license': 'AGPL-3', - 'description':""" + 'description': """ Web Context Tunnel. =================== @@ -15,7 +15,7 @@ arguments. This is annoying as modules often need to pass extra arguments that are not present in the base on_change signatures. As soon as two modules try to alter this signature to add their extra arguments, they are incompatible between them unless some extra glue module make them compatible again by -taking all extra arguments into account. But this leads to a combinatorial +taking all extra arguments into account. But this leads to a combinatorial explosion to make modules compatible again. The solution