diff --git a/bin/sql_db.py b/bin/sql_db.py index 64dbaa0f9e2..a63b2eff205 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -62,7 +62,8 @@ class Cursor(object): count = 0 def check(f): - from functools import wraps + from tools.func import wraps + @wraps(f) def wrapper(self, *args, **kwargs): if not hasattr(self, '_obj'): diff --git a/bin/tools/func.py b/bin/tools/func.py new file mode 100644 index 00000000000..96113e04072 --- /dev/null +++ b/bin/tools/func.py @@ -0,0 +1,31 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2008 Tiny SPRL (). 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 . +# +############################################################################## + +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 diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 06a6654af69..a5be66067da 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -689,7 +689,7 @@ def human_size(sz): return "%0.2f %s" % (s, units[i]) def logged(f): - from functools import wraps + from tools.func import wraps @wraps(f) def wrapper(*args, **kwargs):