[FIX] PEP8 errors in Odoo code only

This commit is contained in:
Maxime Chambreuil
2014-09-30 16:13:16 -04:00
parent 480dfe6543
commit 8d97a7ba01
7 changed files with 82 additions and 57 deletions

View File

@@ -19,9 +19,10 @@
#
##############################################################################
from osv import fields, osv
from osv import osv
from tools.translate import _
class wiki_make_index(osv.osv_memory):
""" Create Index For Selected Page """
@@ -39,17 +40,18 @@ class wiki_make_index(osv.osv_memory):
if context is None:
context = {}
data = context and context.get('active_ids', []) or []
if not data:
return {'type': 'ir.actions.act_window_close'}
for index_obj in self.browse(cr, uid, ids, context=context):
wiki_pool = self.pool.get('wiki.wiki')
cr.execute("Select id, section from wiki_wiki where id IN %s \
order by section ", (tuple(data),))
lst0 = cr.fetchall()
if not lst0[0][1]:
raise osv.except_osv(_('Warning!'), _('There is no section in this Page.'))
raise osv.except_osv(_('Warning!'), _('There is no section in\
this Page.'))
lst = []
s_ids = {}
@@ -60,6 +62,7 @@ class wiki_make_index(osv.osv_memory):
lst.sort()
val = None
def toint(x):
try:
return int(x)
@@ -77,7 +80,8 @@ class wiki_make_index(osv.osv_memory):
if pos >= len(current):
current.append('1')
continue
if (pos == len(l) - 1) or (pos >= len(current2)) or (toint(l[pos]) > toint(current2[pos])):
if (pos == len(l) - 1) or (pos >= len(current2)) or \
(toint(l[pos]) > toint(current2[pos])):
current[pos] = str(toint(current[pos]) + 1)
current = current[:pos + 1]
if pos == len(l) - 1:
@@ -91,7 +95,7 @@ class wiki_make_index(osv.osv_memory):
current2 = l
for rs in result:
wiki_pool.write(cr, uid, [rs[1]], {'section':rs[0]})
wiki_pool.write(cr, uid, [rs[1]], {'section': rs[0]})
return {'type': 'ir.actions.act_window_close'}