Browse Source

fix travis (flake8)

pull/136/head
Alexandre Fayolle 10 years ago
parent
commit
c6787791a5
  1. 6
      base_external_dbsource/base_external_dbsource.py
  2. 5
      database_cleanup/model/purge_columns.py
  3. 3
      database_cleanup/model/purge_tables.py
  4. 4
      email_template_dateutil/email_template.py
  5. 10
      import_odbc/import_odbc.py
  6. 8
      mass_editing/mass_editing.py
  7. 28
      mass_editing/wizard/mass_editing_wizard.py
  8. 5
      server_environment/serv_config.py
  9. 4
      users_ldap_groups/users_ldap_groups.py
  10. 3
      users_ldap_mail/__openerp__.py

6
base_external_dbsource/base_external_dbsource.py

@ -21,9 +21,14 @@
import os
import logging
import psycopg2
from openerp.osv import orm, fields
from openerp.tools.translate import _
import openerp.tools as tools
_logger = logging.getLogger(__name__)
CONNECTORS = []
@ -62,7 +67,6 @@ except:
_logger.info('Oracle libraries not available. Please install "cx_Oracle"\
python package.')
import psycopg2
CONNECTORS.append(('postgresql', 'PostgreSQL'))

5
database_cleanup/model/purge_columns.py

@ -96,8 +96,9 @@ class CleanupPurgeWizardColumn(orm.TransientModel):
columns = list(set([
column for model_pool in model_pools
for column in model_pool._columns
if not (isinstance(model_pool._columns[column], fields.function)
and not model_pool._columns[column].store)
if not (isinstance(model_pool._columns[column],
fields.function) and
not model_pool._columns[column].store)
]))
columns += orm.MAGIC_COLUMNS
columns += self.blacklist.get(model_pools[0]._table, [])

3
database_cleanup/model/purge_tables.py

@ -110,9 +110,8 @@ class CleanupPurgeWizardTable(orm.TransientModel):
known_tables += [
column._sql_names(model_pool)[0]
for column in model_pool._columns.values()
if column._type == 'many2many'
if column._type == 'many2many' and hasattr(column, '_rel')
# unstored function fields of type m2m don't have _rel
and hasattr(column, '_rel')
]
# Cannot pass table names as a psycopg argument

4
email_template_dateutil/email_template.py

@ -22,7 +22,6 @@
from datetime import datetime
import logging
_logger = logging.getLogger(__name__)
import pytz
from jinja2 import contextfilter
@ -34,6 +33,9 @@ from openerp.tools import (
from openerp.addons.email_template import email_template
_logger = logging.getLogger(__name__)
@contextfilter
def format_date(context, dtstr, new_format=None, tz=None):
if not dtstr:

10
import_odbc/import_odbc.py

@ -90,15 +90,13 @@ class import_odbc_dbtable(orm.Model):
def append_to_log(log, level, obj_id='', msg='', rel_id=''):
if '_id_' in obj_id:
obj_id = ('.'.join(obj_id.split('_')[:-2])
+ ': '
+ obj_id.split('_')[-1])
obj_id = ('.'.join(obj_id.split('_')[:-2]) +
': ' + obj_id.split('_')[-1])
if ': .' in msg and not rel_id:
rel_id = msg[msg.find(': .') + 3:]
if '_id_' in rel_id:
rel_id = ('.'.join(rel_id.split('_')[:-2])
+ ': '
+ rel_id.split('_')[-1])
rel_id = ('.'.join(rel_id.split('_')[:-2]) +
': ' + rel_id.split('_')[-1])
msg = msg[:msg.find(': .')]
log['last_log'].append('%s|%s\t|%s\t|%s' % (level.ljust(5),
obj_id,

8
mass_editing/mass_editing.py

@ -32,8 +32,9 @@ class ir_model_fields(orm.Model):
count=False):
model_domain = []
for domain in args:
if (len(domain) > 2 and domain[0] == 'model_id'
and isinstance(domain[2], basestring)):
if (len(domain) > 2 and
domain[0] == 'model_id' and
isinstance(domain[2], basestring)):
model_domain += [
('model_id', 'in', map(int, domain[2][1:-1].split(',')))
]
@ -109,8 +110,7 @@ class mass_object(orm.Model):
'model': src_obj,
'key2': 'client_action_multi',
'value': (
"ir.actions.act_window,"
+ str(vals['ref_ir_act_window'])),
"ir.actions.act_window,%s" % vals['ref_ir_act_window']),
'object': True,
}, context)
self.write(cr, uid, ids, {

28
mass_editing/wizard/mass_editing_wizard.py

@ -69,8 +69,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'colspan': '4', 'nolabel': '1',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove_m2m')]}")})
"{'invisible':[('selection__" +
field.name + "','=','remove_m2m')]}")})
elif field.ttype == "one2many":
all_fields["selection__" + field.name] = {
'type': 'selection',
@ -84,8 +84,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'colspan': '4', 'nolabel': '1',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove_o2m')]}")})
"{'invisible':[('selection__" +
field.name + "','=','remove_o2m')]}")})
elif field.ttype == "many2one":
all_fields["selection__" + field.name] = {
'type': 'selection',
@ -99,8 +99,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'nolabel': '1', 'colspan': '2',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove')]}")})
"{'invisible':[('selection__" +
field.name + "','=','remove')]}")})
elif field.ttype == "char":
all_fields["selection__" + field.name] = {
'type': 'selection',
@ -115,8 +115,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'nolabel': '1',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove')]}"),
"{'invisible':[('selection__" +
field.name + "','=','remove')]}"),
'colspan': '2'})
elif field.ttype == 'selection':
all_fields["selection__" + field.name] = {
@ -128,8 +128,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'nolabel': '1', 'colspan': '2',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove')]}")})
"{'invisible':[('selection__" +
field.name + "','=','remove')]}")})
all_fields[field.name] = {
'type': field.ttype,
'string': field.field_description,
@ -153,8 +153,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'colspan': '4', 'nolabel': '1',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove')]}")})
"{'invisible':[('selection__" +
field.name + "','=','remove')]}")})
else:
all_fields["selection__" + field.name] = {
'type': 'selection',
@ -167,8 +167,8 @@ class mass_editing_wizard(orm.TransientModel):
etree.SubElement(xml_group, 'field', {
'name': field.name, 'nolabel': '1',
'attrs': (
"{'invisible':[('selection__"
+ field.name + "','=','remove')]}"),
"{'invisible':[('selection__" +
field.name + "','=','remove')]}"),
'colspan': '2', })
etree.SubElement(
xml_form, 'separator', {'string': '', 'colspan': '4'})

5
server_environment/serv_config.py

@ -107,8 +107,9 @@ class _Defaults(dict):
__slots__ = ()
def __setitem__(self, key, value):
func = lambda *a: str(value)
return dict.__setitem__(self, key, func)
return dict.__setitem__(self,
key,
lambda *a: str(value))
class ServerConfiguration(orm.TransientModel):

4
users_ldap_groups/users_ldap_groups.py

@ -36,8 +36,8 @@ class CompanyLDAPGroupMapping(orm.Model):
operators = []
members = inspect.getmembers(
users_ldap_groups_operators,
lambda cls: inspect.isclass(cls)
and cls != users_ldap_groups_operators.LDAPOperator)
lambda cls: (inspect.isclass(cls) and
cls != users_ldap_groups_operators.LDAPOperator))
for name, operator in members:
operators.append((name, name))
return tuple(operators)

3
users_ldap_mail/__openerp__.py

@ -23,7 +23,8 @@
'name': "LDAP mapping for user name and e-mail",
'version': "1.0",
'depends': ["auth_ldap"],
'author': "Daniel Reis (https://launchpad.com/~dreis-pt),Odoo Community Association (OCA)",
'author': "Daniel Reis (https://launchpad.com/~dreis-pt),"
"Odoo Community Association (OCA)",
'description': """\
Allows to define the LDAP attributes to use to retrieve user name and e-mail
address.

Loading…
Cancel
Save