Browse Source

[PEP8] Misc

pull/21/head
Sandy Carter 10 years ago
committed by Sandy Carter
parent
commit
49975648a8
  1. 2
      auth_admin_passkey/model/res_users.py
  2. 3
      auth_from_http_basic/__init__.py
  3. 20
      base_external_dbsource/base_external_dbsource.py
  4. 2
      configuration_helper/config.py
  5. 18
      dbfilter_from_header/__openerp__.py
  6. 2
      server_environment_files/__init__.py
  7. 4
      web_context_tunnel/__openerp__.py

2
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):

3
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

20
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

2
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 = {

18
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': [],
},
}

2
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 <http://www.gnu.org/licenses/>.
#
##############################################################################
##############################################################################

4
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

Loading…
Cancel
Save