[FIX] fix bug with functools on python 2.4
bzr revid: christophe@tinyerp.com-20081212114945-jh7djsx6dv8sr1kh
This commit is contained in:
parent
6706f6b07b
commit
a9e7204533
|
@ -62,7 +62,8 @@ class Cursor(object):
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
def check(f):
|
def check(f):
|
||||||
from functools import wraps
|
from tools.func import wraps
|
||||||
|
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
if not hasattr(self, '_obj'):
|
if not hasattr(self, '_obj'):
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
try:
|
||||||
|
from functools import wraps
|
||||||
|
except ImportError:
|
||||||
|
# this module doesn't exist in python < 2.5
|
||||||
|
# we define a identity decorator
|
||||||
|
def wraps(f):
|
||||||
|
def identity(x):
|
||||||
|
return x
|
||||||
|
return identity
|
|
@ -689,7 +689,7 @@ def human_size(sz):
|
||||||
return "%0.2f %s" % (s, units[i])
|
return "%0.2f %s" % (s, units[i])
|
||||||
|
|
||||||
def logged(f):
|
def logged(f):
|
||||||
from functools import wraps
|
from tools.func import wraps
|
||||||
|
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
Loading…
Reference in New Issue